gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit6e72f9d16e72f9d1Merge hm65-fields: episode boot scan reads three fieldsmre6e72f9d1/tests/shortid-owners.hl

1.1 KB

  1. // Growth, colliding keys, misses and owner replacement in the packed lookup.
  2. import PackedOwners from '../lib/shortid-owners.hl'
  3. static alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789'
  4. static sidOf = (Number number) => {
  5. let n = number
  6. let sid = ''
  7. let i = 0
  8. while (i < 5) {
  9. sid = alphabet[n % 36] + sid
  10. n = (n - n % 36) / 36
  11. i = i + 1
  12. }
  13. return sid
  14. }
  15. static verify = () => {
  16. owners = new PackedOwners()
  17. let i = 0
  18. while (i < 5000) {
  19. owners.put(sidOf(i * 1024), 'sowner-' + i)
  20. i = i + 1
  21. }
  22. if (owners.count != 5000) { hlError('lost owner count') }
  23. let j = 0
  24. while (j < 5000) {
  25. if (owners.fetch(sidOf(j * 1024)) != 'sowner-' + j) { hlError('lost owner ' + j) }
  26. j = j + 1
  27. }
  28. if (owners.fetch('zzzzz') != null) { hlError('unknown short id is owned') }
  29. owners.put(sidOf(0), 'pAny-length-UTF8-é-owner')
  30. if (owners.fetch(sidOf(0)) != 'pAny-length-UTF8-é-owner' || owners.count != 5000) { hlError('owner replacement failed') }
  31. owners.put('zzzzz', 'sLast')
  32. if (owners.fetch('zzzzz') != 'sLast') { hlError('claim after growth failed') }
  33. console.log('packed owners: 5000 colliding keys, growth, every lookup, miss, replacement, UTF-8 and new claim passed')
  34. return true
  35. }
  36. verify()

Branches

Latest commits

  • 6e72f9d1Merge hm65-fields: episode boot scan reads three fieldsmre
  • 07a5c883HM65 report measured field projection and complete validationmre
  • 0eab858fRead only catalog date fields during the episode boot scanmre
  • d3179273log: HM65 hl:heap vendoringmre
  • cb78a1a0HM65 report missing heap diagnostic package with repromre
  • 89606a5cHM65 briefmre
  • 096ce0d4log: DP69 live on day48mre
  • b3d8a80bDP69 brief, RV48 mergedmre
  • ce6d7d32Merge rv48: Hybriel day48mre
  • 3da2ea86RV48: report day48 cold starts, gates and cleanupmre
  • 8d9ecdfeRV48: re-vendor Hybriel set day48 (source b6a8f429, bin 660a9524)mre
  • 4a802ae7status: RV48 runningmre
  • 0a5412b6RV48 brief, day48 outmre
  • 56665efelog: CB69 mergedmre
  • 05448a98Merge cb69-imports: appTitle in a dependency-free topicmre
  • e55b379dKeep shared app title independent of the route import graphmre
  • 9a99659blog: hybriel#334, batch waits for day48mre
  • 85fa6c9blog: CB68 result, CB69 startedmre
  • 2f07c1b7log: DP68 boot gate failed, CB68mre
  • 9652782dlog: HM59 merged, DP68 startedmre