Skip to content
Snippets Groups Projects
  1. May 26, 2024
  2. Feb 10, 2024
    • cms's avatar
      more typing · 38eae5a1
      cms authored
      further experiments with type hints
      
      - removing as much run-time checks as feasible
      - the main change here is type declarations for the main `ulid` function
      getting the signature right for the function argument (i.e. :random) was tricky and I don't think that it's being checked at compile time
      i did learn that using 'describe' in sbcl on functions will tell you the inferred type, which is a nice head start
      38eae5a1
  3. Mar 26, 2023
  4. Mar 15, 2023
  5. Mar 14, 2023
  6. Mar 13, 2023
    • cms's avatar
      Merge branch 'rttchecks' into 'main' · 50bf73ae
      cms authored
      Add run time type checks
      
      See merge request colinstrickland/cms-ulid!7
      50bf73ae
    • cms's avatar
      add a unit test for ULID overflow · 822dc511
      cms authored
      we can construct the largest possible ULID manually, and then try and
      ask for another using the same timestamp
      
      it should signal a type error, because we have no headroom left
      822dc511
    • cms's avatar
      Add run time type checks · eb570ba7
      cms authored
      we're relying on the "type system" to protect us against ULID
      overflows, but the compiler checks and assertions aren't guaranteed to
      be portable, so we need to inspect our bounds to see that we don't
      pass the upper limit for ULID according to the spec
      
      rather than ad-hoc checks and `error` like I was using before, this
      can all be simplified to use `check-type`
      eb570ba7
  7. Mar 12, 2023
  8. Mar 11, 2023
    • cms's avatar
      use apply not funcall in the table-driven test · a8deea17
      cms authored
      it means we don't have to destructure the table arguments deeply be
      can just use car and cadr
      a8deea17
    • cms's avatar
      Adds tests for binary functions · 397d311a
      cms authored
      Adds a test to check int->bytes works as expected
      
      Split the root test suite 'all-tests' into two sub suites
      
      - 'ulid has the ulid construction tests
      - 'binary-utils has tests for the binary stuff
      
      you can run them like so
      
      (fiveam:run! 'cms-ulid/tests::ulid)
      (fiveam:run! 'cms-ulid/tests::binary-utils)
      (fiveam:run! 'cms-ulid/tests::all-tests)
      
      or , (asdf:test-system 'cms-ulid) will invoke test-op which
      runs all tests
      
      NB. while testing this iteratively on the repl, I realised that
      the let over the ulid function used to initialise the `last` check
      used to implement the time collision avoidance means that the static
      ulid check is not idempotent - once we've run the test for the fixed
      timestamp once, the ulid constructor will hold onto the fixed time
      397d311a
    • cms's avatar
      Adds docstrings for some of the binary functions · aa6da80b
      cms authored
      explain what they are doing, briefly
      aa6da80b
    • cms's avatar
      add byte8->bits function · 4ee37416
      cms authored
      converts an 8 bit byte into individual bits
      4ee37416
  9. Nov 19, 2022
  10. Nov 12, 2022
Loading