Skip to content

Add high-value property tests for HLC and vector clocks#36

Merged
dexcompiler merged 3 commits intomainfrom
more-clockworks-property-tests
Feb 8, 2026
Merged

Add high-value property tests for HLC and vector clocks#36
dexcompiler merged 3 commits intomainfrom
more-clockworks-property-tests

Conversation

@dexcompiler
Copy link
Copy Markdown
Owner

@dexcompiler dexcompiler commented Feb 8, 2026

HlcTimestampProperties.fs:

  • ToPackedInt64 truncates counter and node id — verifies packed 64-bit encoding masks Counter to 12 bits and NodeId to 4 bits (and preserves wall time in the tested domain).
  • ToString and Parse round-trip — Parse(ts.ToString( )) = ts.
  • ToString and TryParse round-trip — TryParse(ts.ToString( )) succeeds and yields original value.
  • TryParse is non-throwing — TryParse(string?, out VectorClockMessageHeader) never throws for arbitrary input strings (and if it returns true, parsed.ToString( ) matches the input).
  • Operators are consistent with CompareTo — <, >, <=, >= results match CompareTo(HlcTimestamp).
  • WriteTo encoding preserves lexicographic ordering — big-endian 10-byte encoding compares lexicographically the same way as CompareTo(HlcTimestamp).

VectorClockProperties.fs:

  • Merge returns the upper bound when one input dominates — if a <= b then a.Merge(b) = b, if a >= b then a.Merge(b) = a, concurrent case ignored.
  • Merge is monotone with respect to inputs — merged result is never Before either input.
  • Increment is stable under merge with original — clock.Merge(clock.Increment(nodeId)) = incremented and symmetric.

@dexcompiler
Copy link
Copy Markdown
Owner Author

@copilot review this pr

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 8, 2026

@dexcompiler I've opened a new pull request, #37, to work on those changes. Once the pull request is ready, I'll request review from you.

Add high-value property tests for HLC and vector clocks
@dexcompiler dexcompiler merged commit f39fe61 into main Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants