gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit6f7b61ba6f7b61ba|||PR records: deploy-swap fix live, Kunibert findingsTracker6f7b61ba/tests/boot-sort.hl

1.4 KB

  1. // BS2: a paused sort preserves descending order and the input order of equal keys.
  2. import { now } from 'hl:time'
  3. import SortRows from '../lib/sort-rows.hl'
  4. import CatalogSort from '../lib/catalog-sort.hl'
  5. import CatalogList from '../lib/catalog-list.hl'
  6. import { sortEntries } from '../lib/catalog-entries.hl'
  7. import { sortDesc } from '../lib/util.hl'
  8. static check = (Number count) => {
  9. rows = []
  10. list = new CatalogList()
  11. sorter = new SortRows()
  12. for (let i = 0; i < count; i = i + 1) {
  13. row = { id = '' + i key = '' + (i * 17 % 53) }
  14. rows.push(row)
  15. list.insert(list.length, row.id, row.key)
  16. sorter.add(row)
  17. }
  18. let calls = 0
  19. while (!sorter.step(now())) { calls = calls + 1 }
  20. expected = sortDesc(&rows)
  21. if (sorter.count() != expected.length) { hlError('row count') }
  22. for (let i = 0; i < expected.length; i = i + 1) {
  23. got = sorter.row(i)
  24. if (got.id != expected[i].id || got.key != expected[i].key) { hlError('stable row order at ' + i) }
  25. }
  26. packed = new CatalogSort(source = list)
  27. while (!packed.step(now())) { calls = calls + 1 }
  28. old = sortEntries(&list)
  29. if (packed.out.length != old.length) { hlError('packed count') }
  30. for (let i = 0; i < old.length; i = i + 1) {
  31. if (packed.out.fetch(i) != old.fetch(i)) { hlError('packed order at ' + i) }
  32. }
  33. if (count > 100 && calls == 0) { hlError('sort did not yield') }
  34. console.log('boot sort: ' + count + ' rows identical; yielded ' + calls + ' times')
  35. return null
  36. }
  37. check(0)
  38. check(1)
  39. check(4096)

Branches

Latest commits

  • 6f7b61ba|||PR records: deploy-swap fix live, Kunibert findingsTracker
  • c41587d2Merge branch 'bs2' into mainTracker
  • 0dd538a6|||PR BS2: finish the boot index in slices so a booting instance keeps answeringTracker
  • 019d5cedMerge branch 'records-1110' into mainTracker
  • f88ae8b9|||PR records: day56 toggle live, reviewTracker
  • b6b3bb4dMerge branch 'ap56e' into mainTracker
  • 29a26da9|||PR AP56e: guard hidden show helpers during session syncTracker
  • 7c9ec236|||PR AP56e: re-vendor Hybriel set day56 (source 36ae83a8, bin c1f595a2)Tracker
  • 4b54f6f9Merge branch 'records-audit' into mainTracker
  • cab4a3bc|||PR records: branch audit, PR-onlyTracker
  • 641e1c4cMerge branch 'records-dp71' into mainTracker
  • 85a6e9f5|||PR records: DP71 checked in ChromeTracker
  • f5be5f18records: gitoria PR-only planTracker
  • 46a37036records: DP71 liveTracker
  • 3bcb7039Status/log: DP71 in progressTracker
  • 5b3a5693Log: SR1b merged via PR 2, DP71 startedTracker
  • 783957c2Merge branch 'sr1-search' into mainTracker
  • 792b9652README: search results come from the routeTracker
  • fd8570b1|||PR search: one server exchange per keystrokeTracker
  • e8f5cbcaLog: SR1 result, SR1bTracker