-
Notifications
You must be signed in to change notification settings - Fork 9
Added Unit Test that checks the BTreeIndexBase Column implements IComparable #277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests make sense, interesting use of reflection. Have one request.
public sealed class UserHandle : RemoteTableHandle<EventContext, User> | ||
{ | ||
protected override string RemoteTableName => "user"; | ||
|
||
public sealed class IdentityIndex : BTreeIndexBase<SpacetimeDB.Identity> | ||
{ | ||
protected override SpacetimeDB.Identity GetKey(User row) => row.Identity; | ||
|
||
public IdentityIndex(UserHandle table) : base(table) { } | ||
} | ||
|
||
public readonly IdentityIndex Identity; | ||
|
||
internal UserHandle(DbConnection conn) : base(conn) | ||
{ | ||
Identity = new(this); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code won't catch problems that occur if the code generation changes in the future. To catch such problems, we'd need to write the same test against generated code. For example, we could add an index to the Message.Sender field in quickstart-chat -- these tests have access to the quickstart-chat generated code.
If you want to do that, it would be great; if not, I'm willing to merge this, but would appreciate a comment saying why this class is here. // Copy of generated code for a BTreeIndex; TODO: update if that code changes
is messy but at least documents what is going on.
Adds a test to com.clockworklabs.spacetimedbsdk that checks if the BTreeIndexBase class Column implements the IComparable interface. This is the implementation side of issue clockworklabs/SpacetimeDB#2362.
API
Requires SpacetimeDB PRs
No specific PR are required for this change.
Testsuite
SpacetimeDB branch name: master
Testing
dotnet test
, all checks pass.