Skip to content
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

Improve code coverage for scan, especially for N48 #643

Open
thompsonbry opened this issue Jan 14, 2025 · 0 comments
Open

Improve code coverage for scan, especially for N48 #643

thompsonbry opened this issue Jan 14, 2025 · 0 comments

Comments

@thompsonbry
Copy link

N48 tends to be difficult to hit.

See

unodb/test/test_art.cpp

Lines 304 to 354 in f896f77

TYPED_TEST(ARTCorrectnessTest, Node48) {
unodb::test::tree_verifier<TypeParam> verifier;
verifier.insert_key_range(0, 17);
verifier.check_present_values();
verifier.check_absent_keys({17});
#ifdef UNODB_DETAIL_WITH_STATS
verifier.assert_node_counts({17, 0, 0, 1, 0});
verifier.assert_growing_inodes({1, 1, 1, 0});
#endif // UNODB_DETAIL_WITH_STATS
}
TYPED_TEST(ARTCorrectnessTest, FullNode48) {
unodb::test::tree_verifier<TypeParam> verifier;
verifier.insert_key_range(0, 48);
verifier.check_present_values();
verifier.check_absent_keys({49});
#ifdef UNODB_DETAIL_WITH_STATS
verifier.assert_node_counts({48, 0, 0, 1, 0});
verifier.assert_growing_inodes({1, 1, 1, 0});
#endif // UNODB_DETAIL_WITH_STATS
}
TYPED_TEST(ARTCorrectnessTest, Node48KeyPrefixSplit) {
unodb::test::tree_verifier<TypeParam> verifier;
verifier.insert_key_range(10, 17);
#ifdef UNODB_DETAIL_WITH_STATS
verifier.assert_node_counts({17, 0, 0, 1, 0});
verifier.assert_growing_inodes({1, 1, 1, 0});
verifier.assert_key_prefix_splits(0);
#endif // UNODB_DETAIL_WITH_STATS
// Insert a value that does share full prefix with the current Node48
verifier.insert(0x100020, unodb::test::test_values[0]);
verifier.check_present_values();
verifier.check_absent_keys({9, 27, 0x100019, 0x100100, 0x110000});
#ifdef UNODB_DETAIL_WITH_STATS
verifier.assert_node_counts({18, 1, 0, 1, 0});
verifier.assert_growing_inodes({2, 1, 1, 0});
verifier.assert_key_prefix_splits(1);
#endif // UNODB_DETAIL_WITH_STATS
}
and add iterator / scan operations into these tests to improve the code coverage in a focused manner.

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

No branches or pull requests

1 participant