From 5a0b15177f85b349811e6d493adca15e6971e3a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Kejser=20Jensen?= Date: Sat, 22 Aug 2026 12:32:52 +0200 Subject: [PATCH 1/4] Change proptest to property_test --- Cargo.lock | 317 +++++++++--------- Cargo.toml | 2 +- .../modelardb_compression/src/models/bits.rs | 15 +- .../src/models/macaque_v.rs | 47 +-- .../modelardb_compression/src/models/mod.rs | 138 +++++--- .../src/models/pmc_mean.rs | 119 ++++--- .../modelardb_compression/src/models/swing.rs | 125 +++---- .../src/models/timestamps.rs | 10 +- .../src/storage/uncompressed_data_buffer.rs | 67 +++- crates/modelardb_types/src/types.rs | 45 ++- 10 files changed, 495 insertions(+), 390 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3065b7dda..c5fdd78ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -24,9 +24,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" dependencies = [ "memchr", ] @@ -54,9 +54,9 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "android_system_properties" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" dependencies = [ "libc", ] @@ -135,12 +135,6 @@ dependencies = [ "rustversion", ] -[[package]] -name = "arrayref" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" - [[package]] name = "arrayvec" version = "0.7.8" @@ -407,9 +401,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.91" +version = "0.1.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae36dc4177970ef04fde5178d3e2429882def40e57a451f919c098f72baa6cec" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" dependencies = [ "proc-macro2", "quote", @@ -439,9 +433,9 @@ checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" [[package]] name = "aws-config" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b180a3c8b55960db3426d8964b8745e652466a1a49fe1a2eda828046d30b5e4" +checksum = "a767267da9e2c2e189b2f9df8b5657e850ecf5352644734ba130d4a57095cf1b" dependencies = [ "aws-credential-types", "aws-runtime", @@ -482,9 +476,9 @@ dependencies = [ [[package]] name = "aws-lc-rs" -version = "1.17.3" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00bdb5da18dac48ca2cc7cd4a98e533e8635a58e2361d13a1a4ee3888e0d72f1" +checksum = "ce2b2dcc879c3bae0d371e77c99f2238400ef24ec001394befa67b6e543add9e" dependencies = [ "aws-lc-sys", "zeroize", @@ -492,9 +486,9 @@ dependencies = [ [[package]] name = "aws-lc-sys" -version = "0.43.0" +version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43103168cc76fe62678a375e722fc9cb3a0146159ac5828bc4f0dfd755c2224c" +checksum = "f09fae7be8bb3174e05c6afdb34199e6dc0c7c04ba9fa237b1967adfbde27483" dependencies = [ "cc", "cmake", @@ -530,9 +524,9 @@ dependencies = [ [[package]] name = "aws-sdk-dynamodb" -version = "1.119.0" +version = "1.122.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0176c1927f2e065f43cecde84602f769959b34ab53a317da92a64022ba09345" +checksum = "da6141acba66f1db7da2b3c7b2c0ee5178f86240cee676ed5c37cf74b9a2b37b" dependencies = [ "arc-swap", "aws-credential-types", @@ -552,13 +546,14 @@ dependencies = [ "http 1.5.0", "regex-lite", "tracing", + "url", ] [[package]] name = "aws-sdk-sso" -version = "1.105.0" +version = "1.107.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ffd0fbe7873cb548a7aa60f9573c268fff94155397fd4f14dc9f1ecaaab8516" +checksum = "769b0abd0f89cfe11da5099986dd493e4f94347ce9a4562cb86ddecfe926b6c0" dependencies = [ "arc-swap", "aws-credential-types", @@ -582,9 +577,9 @@ dependencies = [ [[package]] name = "aws-sdk-ssooidc" -version = "1.107.0" +version = "1.109.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "175763eb222a46377df7aa257a3bca980ab3e96703fefc8f4d0b8da6ad2e254c" +checksum = "f4075b8a2c8cda4076a3dcc43b9d6dabd93e0c2502abeaaf7e14aaead9bb312b" dependencies = [ "arc-swap", "aws-credential-types", @@ -608,9 +603,9 @@ dependencies = [ [[package]] name = "aws-sdk-sts" -version = "1.110.0" +version = "1.112.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b14781dfbff48984017d57167b6ea0b6471c6920ec52b44a2677c7feb3c13" +checksum = "3f582002918346a3e685be1b391c7bea155073088cea6bd4e4b7663df9e43b6c" dependencies = [ "arc-swap", "aws-credential-types", @@ -689,9 +684,9 @@ dependencies = [ [[package]] name = "aws-smithy-http-client" -version = "1.2.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "635d23afda0a6ab48d666c4d447c4873e8d1e83518a2be2093122397e50b838e" +checksum = "ebfd138fac0337cee7516c352757ea73b9f2266e57d0bcb5bc70e9547e45aef1" dependencies = [ "aws-smithy-async", "aws-smithy-runtime-api", @@ -746,9 +741,9 @@ dependencies = [ [[package]] name = "aws-smithy-runtime" -version = "1.12.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07505b34e8f4b3591a4fa69e9792b52289b95488dbbc68c3c0075b7bedb245e1" +checksum = "b82e438d30e02a825d363bd639a9efaed68a8089d86101054b0081e7e0d3e606" dependencies = [ "aws-smithy-async", "aws-smithy-http", @@ -772,9 +767,9 @@ dependencies = [ [[package]] name = "aws-smithy-runtime-api" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b98f2e1fd67ec06618f9c291e5e495a468e60519e44c9c1979cd0521f3affdb" +checksum = "954c563ce84507722d2679f07a35d21b9c6466b3872d513020d0281fc8112ac9" dependencies = [ "aws-smithy-async", "aws-smithy-runtime-api-macros", @@ -812,9 +807,9 @@ dependencies = [ [[package]] name = "aws-smithy-types" -version = "1.6.1" +version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6dc683efb34b9e755675b37fedbe0103141e5b6df7bdc9eb6967756a8c167d8" +checksum = "fce83ce9abbb198d25bc7131e468d0f9fe1257125e58c39f3f9fc9f5098c9647" dependencies = [ "base64-simd", "bytes", @@ -983,11 +978,10 @@ dependencies = [ [[package]] name = "blake3" -version = "1.8.5" +version = "1.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aa83c34e62843d924f905e0f5c866eb1dd6545fc4d719e803d9ba6030371fce" +checksum = "6d9e454fc11f76977dc803893aff6304ed33d6a26efae8696573bea74baa27ae" dependencies = [ - "arrayref", "arrayvec", "cc", "cfg-if", @@ -1123,9 +1117,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.4.0" +version = "1.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5add81bb678e6cb321aff7fa0dc7689ad82b112dbc032cea19f91d6b8e3582b9" +checksum = "0ad534f4357a5264cce5019c989cf66a4f0dc4e0d1b1d15f8aacec0ff7360273" dependencies = [ "find-msvc-tools", "jobserver", @@ -1182,9 +1176,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.6.5" +version = "4.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301b56658598e48f3648647ac6fc887be7e7108eddfa4e9b63fcf3ec58c0cadf" +checksum = "473c7e07f409a8d772161724aa8db6a765a2532a70f9667eeb7b49d3d02fbdca" dependencies = [ "clap_builder", "clap_derive", @@ -1192,9 +1186,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.6.5" +version = "4.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94a65403d1a1bd28f7dc68eb8506e8874808ee5eecb59298de588e2e1407a078" +checksum = "7b48fea5a88e9ae728a2dcbedbfc0e730f7d60da42e1cb049a83c9fb8b789889" dependencies = [ "anstream", "anstyle", @@ -1332,6 +1326,15 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "convert_case" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "affbf0190ed2caf063e3def54ff444b449371d55c58e513a95ab98eca50adb49" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core-foundation" version = "0.9.4" @@ -2348,7 +2351,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5a646e2b05608db1e5f91e75b6af841d92294ea0864789bb01f3f818e5f7b25" dependencies = [ - "convert_case", + "convert_case 0.9.0", "itertools", "proc-macro2", "quote", @@ -2439,9 +2442,9 @@ checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] name = "either" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5e8f6c15a24b9a3ee5efec809ccd006d3b30e8b3bb63c39af737c7f87daa1d" +checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34" [[package]] name = "encoding_rs" @@ -2476,9 +2479,9 @@ dependencies = [ [[package]] name = "error-code" -version = "3.3.2" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dea2df4cf52843e0452895c455a1a2cfbb842a1e7329671acf418fdc53ed4c59" +checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7" [[package]] name = "fastrand" @@ -2488,9 +2491,9 @@ checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" [[package]] name = "find-msvc-tools" -version = "0.1.9" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" +checksum = "d45db016d36b838f563236e9193d0ee6ce38f3f68b6c94e914b4929c96bbb890" [[package]] name = "fixedbitset" @@ -2554,9 +2557,9 @@ checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" [[package]] name = "futures" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a88cf1f829d945f548cf8fec32c61b1f202b6d93b45848602fc02af4b12ad218" +checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3" dependencies = [ "futures-channel", "futures-core", @@ -2569,9 +2572,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "262590f4fe6afeb0bc83be1daa64e52657fe185690a958af7f3ad0e92085c5ae" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" dependencies = [ "futures-core", "futures-sink", @@ -2579,15 +2582,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cd50c473c80f6d7c3670a752354b8e569b1a7cbfdc0419ec88e5edad85e0dc7" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" [[package]] name = "futures-executor" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6754879cc9f2c66f88c6e5c35344bb0bdb0708b0352b1201815667c7eabc7458" +checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432" dependencies = [ "futures-core", "futures-task", @@ -2596,38 +2599,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4577ecaa3c4f96589d473f679a71b596316f6641bc350038b962a5daf0085d7a" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" [[package]] name = "futures-macro" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d6d3cde68c518367be28956066ddfef33813991b77a55005a69dae04bf3b10b" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" dependencies = [ "proc-macro2", "quote", - "syn 2.0.119", + "syn 3.0.3", ] [[package]] name = "futures-sink" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e34418ac499d6305c2fb5ad0ed2f6ac998c5f8ca209b4510f7f94242c647e307" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" [[package]] name = "futures-task" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b231ed28831efb4a61a08580c4bc233ec56bc009f4cd8f52da2c3cb97df0c109" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" [[package]] name = "futures-util" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a77a90a256fce34da66415271e30f94ee91c57b04b8a2c042d9cf3220179deaa" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" dependencies = [ "futures-channel", "futures-core", @@ -2697,9 +2700,9 @@ checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" [[package]] name = "h2" -version = "0.4.15" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cb093c84e8bd9b188d4c4a8cb6579fc016968d14c99882163cd3ff402a4f155" +checksum = "839c0e8a181239723652be9062bb56ca5bf5f64011f73b623f6f4fc59086a228" dependencies = [ "atomic-waker", "bytes", @@ -2838,9 +2841,9 @@ dependencies = [ [[package]] name = "http-body-util" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9f41fd6a08e4d4ec69df65976da761afd5ad5e58a9d4acb46bd1c953a9e3ff2" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" dependencies = [ "bytes", "futures-core", @@ -2978,9 +2981,9 @@ dependencies = [ [[package]] name = "icu_collections" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" +checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513" dependencies = [ "displaydoc", "potential_utf", @@ -2992,9 +2995,9 @@ dependencies = [ [[package]] name = "icu_locale_core" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" +checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb" dependencies = [ "displaydoc", "litemap", @@ -3005,9 +3008,9 @@ dependencies = [ [[package]] name = "icu_normalizer" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" +checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f" dependencies = [ "icu_collections", "icu_normalizer_data", @@ -3019,16 +3022,17 @@ dependencies = [ [[package]] name = "icu_normalizer_data" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" +checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0" [[package]] name = "icu_properties" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" +checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148" dependencies = [ + "displaydoc", "icu_collections", "icu_locale_core", "icu_properties_data", @@ -3039,15 +3043,15 @@ dependencies = [ [[package]] name = "icu_properties_data" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" +checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa" [[package]] name = "icu_provider" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" +checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73" dependencies = [ "displaydoc", "icu_locale_core", @@ -3189,9 +3193,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.103" +version = "0.3.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b44bfcdb3f8d5837a46dae1ca9660a837176eee74a28b229bc626816589102" +checksum = "0e0c1080212aad755ea003d18543e8768dd432c48819efd73a7bf1e39b7a5a3a" dependencies = [ "cfg-if", "futures-util", @@ -3275,18 +3279,18 @@ checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" [[package]] name = "liblzma" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45aec2360b3933207e27908049d8e4df4e476b58180afb1e56b2a4fb72efe4ba" +checksum = "2fe0a34ca854fd4f20c07f696fc8675aec78f87d88d29f5e10257a7490a1b2e1" dependencies = [ "liblzma-sys", ] [[package]] name = "liblzma-sys" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a046c7f353ba30f810545151e04f63545833803f5b86ee3ddf1517247fe560a5" +checksum = "a0dad045e4b1b7b170be4b60b54b780cafb4490165461bac7d1cf7b703f61d5f" dependencies = [ "cc", "libc", @@ -3301,9 +3305,9 @@ checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "libredox" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2026a5056764a10b2bf5d56488cba40da507f5493a6a429340e2004d9ed085fa" +checksum = "28d0a00925a9f930d679b6789b721e3a7f9ed110f41b86d2497caa780c3a070a" dependencies = [ "libc", ] @@ -3322,9 +3326,9 @@ checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "litemap" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" [[package]] name = "lock_api" @@ -3740,9 +3744,9 @@ checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" [[package]] name = "num-integer" -version = "0.1.46" +version = "0.1.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" dependencies = [ "num-traits", ] @@ -4015,15 +4019,15 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" [[package]] name = "potential_utf" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" dependencies = [ "zerovec", ] @@ -4094,6 +4098,7 @@ dependencies = [ "bit-vec", "bitflags", "num-traits", + "proptest-macro", "rand 0.9.5", "rand_chacha", "rand_xorshift", @@ -4103,6 +4108,18 @@ dependencies = [ "unarray", ] +[[package]] +name = "proptest-macro" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efaa288b896cb2b345da7b7f2110ab19e51565b83495b56fcec98a62f8b1f33e" +dependencies = [ + "convert_case 0.11.0", + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "prost" version = "0.14.4" @@ -4241,9 +4258,9 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.11.16" +version = "0.11.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f4bfc015262b9df63c8845072ce59068853ff5872180c2ce2f13038b970e560" +checksum = "04759210543be93709136e28212294a659ef5001836ff4eab4d663e4529bba83" dependencies = [ "aws-lc-rs", "bytes", @@ -4425,9 +4442,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.16" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fcfdb36bda0c880c5931cdc7a2bcdc8ba4556847b9d912bca70bc94708711ad" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" dependencies = [ "aho-corasick", "memchr", @@ -4542,9 +4559,9 @@ dependencies = [ [[package]] name = "roaring" -version = "0.11.4" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dedc5658c6ecb3bdb5ef5f3295bb9253f42dcf3fd1402c03f6b1f7659c3c4a9" +checksum = "18bd8a37d17a58532776dcdf6041ce64929adca78e8489d5cacbafe99229d3e1" dependencies = [ "bytemuck", "byteorder", @@ -4644,9 +4661,9 @@ checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" [[package]] name = "rustls-webpki" -version = "0.103.13" +version = "0.103.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e" +checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2" dependencies = [ "aws-lc-rs", "ring", @@ -4928,18 +4945,18 @@ checksum = "199905e6153d6405f9728fe44daace35f8f837bbf830bb6e85fbd5828709a886" [[package]] name = "snmalloc-rs" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "530a04ae687609072d0edd38866406fbbcd23d2f716791437e312ec4d64a355a" +checksum = "50071c36c95c01969e0f7d8cc7ed98bfdeeef4b527de391308635b52096f24a1" dependencies = [ "snmalloc-sys", ] [[package]] name = "snmalloc-sys" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a96cbeb16d6bcc5979f80ec907582a886b7fb3b9a707678b63dd93a10d8ee858" +checksum = "0fcaa86cecb1b1ccc4f4e7c7af6f675b79ca0be0e2a03f8ea690a97c756f7a72" dependencies = [ "cc", "cmake", @@ -5121,18 +5138,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.19" +version = "2.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a43598840e33d5b0331f38c5e30d13bb11c11210a4b58f0d9b18a5a5eefcd9" +checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.19" +version = "2.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43cbfe0cf76104d42a574802844187e84a305e531ed54455f11fbde0f10541cd" +checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af" dependencies = [ "proc-macro2", "quote", @@ -5200,9 +5217,9 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" +checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" dependencies = [ "displaydoc", "zerovec", @@ -5580,9 +5597,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.24.0" +version = "1.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf3923a6f5c4c6382e0b653c4117f48d631ea17f38ed86e2a828e6f7412f5239" +checksum = "2cefc03fd367c0c6d4305de1b312cf00248c4114f4a0418ce6a6af769e3b0bd9" dependencies = [ "getrandom 0.4.3", "js-sys", @@ -5684,9 +5701,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.126" +version = "0.2.127" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b067c0c11094aef6b7a801c1e34a26affafdf3d051dba08456b868789aaf9a4" +checksum = "1b70935747edd64d89de3efa29d73789b806c15798f8e7dca4d8ac356b50ce70" dependencies = [ "cfg-if", "once_cell", @@ -5697,9 +5714,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.76" +version = "0.4.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62df1340f32221cb9c54d6a27b030e3dba64361d4a95bed55f9aacb44da291d" +checksum = "6b7777d5cc23d0e91404e53ce2d5e8ec7acae3026b16233dba62cd3246457950" dependencies = [ "js-sys", "wasm-bindgen", @@ -5707,9 +5724,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.126" +version = "0.2.127" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167ce5e579f6bcf889c4f7175a8a5a585de84e8ff93976ce393efa5f2837aab1" +checksum = "77775f8f3f7217702089053b94958f8f54061a3f663417df76e19cbdcca29bc1" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5717,9 +5734,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.126" +version = "0.2.127" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3997c7839262f4ef12cf90b818d6340c18e80f263f1a94bf157d0ec4420380e" +checksum = "e11d33f857dc2fb11b8bc75aee111aa9cbeb12cd9f25efd3d4c2a3dd4e235284" dependencies = [ "bumpalo", "proc-macro2", @@ -5730,9 +5747,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.126" +version = "0.2.127" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1b4cb0cc549fcf58d7dfc081778139b3d283a081644e833e84682ad71cea24" +checksum = "7ef64dbcc55df09c7e5a46182d181c2cfa3e925f3da937ea764728b4bbb9dcbf" dependencies = [ "unicode-ident", ] @@ -5752,9 +5769,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.103" +version = "0.3.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8622dcb61c0bcc9fffa6938bed81210af2da9a7e4a1a834b2e37a59b6dfb6141" +checksum = "c435338968042f4f59a557f690a253676d47ce13ceb55d70100e7facf6620a30" dependencies = [ "js-sys", "wasm-bindgen", @@ -6027,9 +6044,9 @@ checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" [[package]] name = "writeable" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" [[package]] name = "xmlparser" @@ -6068,18 +6085,18 @@ checksum = "c6e61e59a957b7ccee15d2049f86e8bfd6f66968fcd88f018950662d9b86e675" [[package]] name = "zerocopy" -version = "0.8.55" +version = "0.8.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a105cd7b140f6eeec8acff2ea38135d3cab283ada58540f629fe51e46696eb" +checksum = "556764e583adb45a9f8d413c2a147fa7e8d821e48e12b14fd560b607998b75eb" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.55" +version = "0.8.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fe976fb70c78cd64cccfe3a6fc142244e8a77b70959b30faf9d0ac37ee228eb" +checksum = "f2ab42fc20575779bd240faa45f94a74256f755c0fa9e89f0ede20d91d0cdfc1" dependencies = [ "proc-macro2", "quote", @@ -6115,9 +6132,9 @@ checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" [[package]] name = "zerotrie" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" dependencies = [ "displaydoc", "yoke", @@ -6126,9 +6143,9 @@ dependencies = [ [[package]] name = "zerovec" -version = "0.11.6" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" +checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8" dependencies = [ "yoke", "zerofrom", @@ -6137,20 +6154,20 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.11.3" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" +checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.119", + "syn 3.0.3", ] [[package]] name = "zlib-rs" -version = "0.6.6" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b142a20ec14a91d5bc708c1dc21b080c550113d8aa77afa29635673a65dd02c5" +checksum = "34b31d188d9d685a4f9c7b46d6e36631b07058d2cfe190267adce54dc230bf12" [[package]] name = "zmij" diff --git a/Cargo.toml b/Cargo.toml index 79beb02a8..b33400869 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,7 +47,7 @@ modelardb_storage = { path = "crates/modelardb_storage"} modelardb_test = { path = "crates/modelardb_test"} modelardb_types = { path = "crates/modelardb_types"} object_store = "0.13.2" -proptest = "1.11.0" +proptest = { version = "1.11.0", features = ["attr-macro"]} prost = "0.14.3" prost-build = "0.14.3" protox = "0.9.1" diff --git a/crates/modelardb_compression/src/models/bits.rs b/crates/modelardb_compression/src/models/bits.rs index ed694fe3a..4df194b47 100644 --- a/crates/modelardb_compression/src/models/bits.rs +++ b/crates/modelardb_compression/src/models/bits.rs @@ -182,7 +182,7 @@ impl Default for BitVecBuilder { #[cfg(test)] mod tests { use super::*; - use proptest::{bool, collection, prop_assert, prop_assume, proptest}; + use proptest::{bool, collection, prop_assert, prop_assume, property_test}; // The largest byte, a random byte, and the smallest byte for testing. const TEST_BYTES: &[u8] = &[255, 170, 0]; @@ -311,16 +311,19 @@ mod tests { )); } - proptest! { - #[test] - fn test_writing_and_reading_random_bits(bits in collection::vec(bool::ANY, 0..50)) { + #[property_test] + fn test_writing_and_reading_random_bits( + #[strategy = collection::vec(bool::ANY, 0..50)] bits: Vec, + ) { prop_assume!(!bits.is_empty()); let mut bit_vector_builder = BitVecBuilder::new(); for bit in &bits { write_bool_as_bit(&mut bit_vector_builder, *bit); } - prop_assert!(bytes_and_bits_are_equal(&bit_vector_builder.finish(), &bits)); - } + prop_assert!(bytes_and_bits_are_equal( + &bit_vector_builder.finish(), + &bits + )); } fn bytes_and_bits_are_equal(bytes: &[u8], bits: &[bool]) -> bool { diff --git a/crates/modelardb_compression/src/models/macaque_v.rs b/crates/modelardb_compression/src/models/macaque_v.rs index d8b6ca887..56c521bee 100644 --- a/crates/modelardb_compression/src/models/macaque_v.rs +++ b/crates/modelardb_compression/src/models/macaque_v.rs @@ -341,7 +341,7 @@ mod tests { use modelardb_test::ERROR_BOUND_TEN; use proptest::num::f32 as ProptestValue; - use proptest::{bool, collection, prop_assert, prop_assert_eq, prop_assume, proptest}; + use proptest::{bool, collection, prop_assert, prop_assert_eq, prop_assume, property_test}; use crate::models; @@ -351,29 +351,33 @@ mod tests { assert!(MacaqueV::new(ErrorBound::Lossless).model().0.is_empty()); } - proptest! { - #[test] - fn test_append_single_value_with_lossless_error_bound(value in ProptestValue::ANY) { + #[property_test] + fn test_append_single_value_with_lossless_error_bound(value: f32) { let mut model_type = MacaqueV::new(ErrorBound::Lossless); model_type.compress_values(&[value]); - prop_assert!(models::equal_or_nan(value as f64, model_type.last_value as f64)); + prop_assert!(models::equal_or_nan( + value as f64, + model_type.last_value as f64 + )); prop_assert_eq!(model_type.last_leading_zero_bits, u8::MAX); prop_assert_eq!(model_type.last_trailing_zero_bits, 0); } - #[test] - fn test_append_repeated_values_with_lossless_error_bound(value in ProptestValue::ANY) { + #[property_test] + fn test_append_repeated_values_with_lossless_error_bound(value: f32) { let mut model_type = MacaqueV::new(ErrorBound::Lossless); model_type.compress_values(&[value, value]); - prop_assert!(models::equal_or_nan(value as f64, model_type.last_value as f64)); + prop_assert!(models::equal_or_nan( + value as f64, + model_type.last_value as f64 + )); prop_assert_eq!(model_type.last_leading_zero_bits, u8::MAX); prop_assert_eq!(model_type.last_trailing_zero_bits, 0); } - } #[test] fn test_append_different_values_with_leading_zero_bits_with_lossless_error_bound() { @@ -433,18 +437,17 @@ mod tests { } // Tests for sum(). - proptest! { - #[test] - fn test_sum_with_lossless_error_bound(values in collection::vec(ProptestValue::ANY, 0..50)) { + #[property_test] + fn test_sum_with_lossless_error_bound( + #[strategy = collection::vec(ProptestValue::ANY, 0..50)] values: Vec, + ) { prop_assume!(!values.is_empty()); let expected_sum = values.iter().sum::(); - let compressed_values = compress_values_using_macaque_v( - ErrorBound::Lossless, - &values, None); + let compressed_values = + compress_values_using_macaque_v(ErrorBound::Lossless, &values, None); let sum = sum(values.len(), &compressed_values, None); prop_assert!(models::equal_or_nan(expected_sum as f64, sum as f64)); } - } #[test] fn test_sum_model_single_value_with_lossless_error_bound() { @@ -464,14 +467,12 @@ mod tests { } // Tests for grid(). - proptest! { - #[test] - fn test_grid_with_lossless_error_bound(values in collection::vec(ProptestValue::ANY, 0..50)) { + #[property_test] + fn test_grid_with_lossless_error_bound( + #[strategy = collection::vec(ProptestValue::ANY, 0..50)] values: Vec, + ) { prop_assume!(!values.is_empty()); - assert_grid_with_error_bound( - ErrorBound::Lossless, - &values); - } + assert_grid_with_error_bound(ErrorBound::Lossless, &values); } fn assert_grid_with_error_bound(error_bound: ErrorBound, values: &[Value]) { diff --git a/crates/modelardb_compression/src/models/mod.rs b/crates/modelardb_compression/src/models/mod.rs index 13f235274..d1a540a13 100644 --- a/crates/modelardb_compression/src/models/mod.rs +++ b/crates/modelardb_compression/src/models/mod.rs @@ -290,100 +290,136 @@ mod tests { use modelardb_test::{ ERROR_BOUND_ABSOLUTE_MAX, ERROR_BOUND_ONE, ERROR_BOUND_RELATIVE_MAX, ERROR_BOUND_TEN, }; - use proptest::num; - use proptest::num::f32 as ProptestValue; - use proptest::{prop_assert, prop_assume, proptest}; + use proptest::{prop_assert, prop_assume, property_test}; // Tests for is_value_within_error_bound(). - proptest! { - #[test] - fn test_same_value_is_always_within_lossless_error_bound(value in ProptestValue::ANY) { - prop_assert!(is_value_within_error_bound(ErrorBound::Lossless, value, value)); + #[property_test] + fn test_same_value_is_always_within_lossless_error_bound(value: Value) { + prop_assert!(is_value_within_error_bound( + ErrorBound::Lossless, + value, + value + )); } - #[test] - fn test_other_value_is_never_within_absolute_error_bound_of_positive_infinity(value in ProptestValue::ANY) { + #[property_test] + fn test_other_value_is_never_within_absolute_error_bound_of_positive_infinity(value: Value) { prop_assume!(value != Value::INFINITY); prop_assert!(!is_value_within_error_bound( - ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(), Value::INFINITY, value)); + ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(), + Value::INFINITY, + value + )); } - #[test] - fn test_other_value_is_never_within_relative_error_bound_of_positive_infinity(value in ProptestValue::ANY) { + #[property_test] + fn test_other_value_is_never_within_relative_error_bound_of_positive_infinity(value: Value) { prop_assume!(value != Value::INFINITY); prop_assert!(!is_value_within_error_bound( - ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(), Value::INFINITY, value)); + ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(), + Value::INFINITY, + value + )); } - #[test] - fn test_other_value_is_never_within_absolute_error_bound_of_negative_infinity(value in ProptestValue::ANY) { + #[property_test] + fn test_other_value_is_never_within_absolute_error_bound_of_negative_infinity(value: Value) { prop_assume!(value != Value::NEG_INFINITY); prop_assert!(!is_value_within_error_bound( - ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(), Value::NEG_INFINITY, value)); + ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(), + Value::NEG_INFINITY, + value + )); } - #[test] - fn test_other_value_is_never_within_relative_error_bound_of_negative_infinity(value in ProptestValue::ANY) { + #[property_test] + fn test_other_value_is_never_within_relative_error_bound_of_negative_infinity(value: Value) { prop_assume!(value != Value::NEG_INFINITY); prop_assert!(!is_value_within_error_bound( - ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(), Value::NEG_INFINITY, value)); + ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(), + Value::NEG_INFINITY, + value + )); } - #[test] - fn test_other_value_is_never_within_absolute_error_bound_of_nan(value in ProptestValue::ANY) { + #[property_test] + fn test_other_value_is_never_within_absolute_error_bound_of_nan(value: Value) { prop_assume!(!value.is_nan()); prop_assert!(!is_value_within_error_bound( - ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(), Value::NAN, value)); + ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(), + Value::NAN, + value + )); } - #[test] - fn test_other_value_is_never_within_relative_error_bound_of_nan(value in ProptestValue::ANY) { + #[property_test] + fn test_other_value_is_never_within_relative_error_bound_of_nan(value: Value) { prop_assume!(!value.is_nan()); prop_assert!(!is_value_within_error_bound( - ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(), Value::NAN, value)); + ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(), + Value::NAN, + value + )); } - #[test] - fn test_positive_infinity_is_never_within_absolute_error_bound_of_other_value(value in ProptestValue::ANY) { + #[property_test] + fn test_positive_infinity_is_never_within_absolute_error_bound_of_other_value(value: Value) { prop_assume!(value != Value::INFINITY); prop_assert!(!is_value_within_error_bound( - ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(), value, Value::INFINITY)); + ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(), + value, + Value::INFINITY + )); } - #[test] - fn test_positive_infinity_is_never_within_relative_error_bound_of_other_value(value in ProptestValue::ANY) { + #[property_test] + fn test_positive_infinity_is_never_within_relative_error_bound_of_other_value(value: Value) { prop_assume!(value != Value::INFINITY); prop_assert!(!is_value_within_error_bound( - ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(), value, Value::INFINITY)); + ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(), + value, + Value::INFINITY + )); } - #[test] - fn test_negative_infinity_is_never_within_absolute_error_bound_of_other_value(value in ProptestValue::ANY) { + #[property_test] + fn test_negative_infinity_is_never_within_absolute_error_bound_of_other_value(value: Value) { prop_assume!(value != Value::NEG_INFINITY); prop_assert!(!is_value_within_error_bound( - ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(), value, Value::NEG_INFINITY)); + ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(), + value, + Value::NEG_INFINITY + )); } - #[test] - fn test_negative_infinity_is_never_within_relative_error_bound_of_other_value(value in ProptestValue::ANY) { + #[property_test] + fn test_negative_infinity_is_never_within_relative_error_bound_of_other_value(value: Value) { prop_assume!(value != Value::NEG_INFINITY); prop_assert!(!is_value_within_error_bound( - ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(), value, Value::NEG_INFINITY)); + ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(), + value, + Value::NEG_INFINITY + )); } - #[test] - fn test_nan_is_never_within_absolute_error_bound_of_other_value(value in ProptestValue::ANY) { + #[property_test] + fn test_nan_is_never_within_absolute_error_bound_of_other_value(value: Value) { prop_assume!(!value.is_nan()); prop_assert!(!is_value_within_error_bound( - ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(), value, Value::NAN)); + ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(), + value, + Value::NAN + )); } - #[test] - fn test_nan_is_never_within_relative_error_bound_of_other_value(value in ProptestValue::ANY) { + #[property_test] + fn test_nan_is_never_within_relative_error_bound_of_other_value(value: Value) { prop_assume!(!value.is_nan()); prop_assert!(!is_value_within_error_bound( - ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(), value, Value::NAN)); - } + ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(), + value, + Value::NAN + )); } #[test] @@ -416,17 +452,15 @@ mod tests { } // Tests for equal_or_nan(). - proptest! { - #[test] - fn test_equal_or_nan_equal(value in num::f64::ANY) { + #[property_test] + fn test_equal_or_nan_equal(value: f64) { assert!(equal_or_nan(value, value)); } - #[test] - fn test_equal_or_nan_not_equal(v1 in num::f64::ANY, v2 in num::f64::ANY) { - prop_assume!(v1 != v2 && !v1.is_nan() && !v2.is_nan()); - prop_assert!(!equal_or_nan(v1, v2)); - } + #[property_test] + fn test_equal_or_nan_not_equal(value_one: f64, value_two: f64) { + prop_assume!(value_one != value_two && !value_one.is_nan() && !value_two.is_nan()); + prop_assert!(!equal_or_nan(value_one, value_two)); } // Tests for decompress_all_timestamps_and_split_into_models_and_residuals(). diff --git a/crates/modelardb_compression/src/models/pmc_mean.rs b/crates/modelardb_compression/src/models/pmc_mean.rs index 94a97d9e9..61e6212db 100644 --- a/crates/modelardb_compression/src/models/pmc_mean.rs +++ b/crates/modelardb_compression/src/models/pmc_mean.rs @@ -112,16 +112,13 @@ mod tests { use super::*; use modelardb_test::{ERROR_BOUND_ABSOLUTE_MAX, ERROR_BOUND_FIVE, ERROR_BOUND_RELATIVE_MAX}; - use proptest::num::f32 as ProptestValue; - use proptest::{prop_assert, prop_assume, proptest}; + use proptest::{prop_assert, prop_assume, property_test}; // Tests for PMCMean. - proptest! { - #[test] - fn test_can_fit_sequence_of_finite_value_with_lossless_error_bound(value in ProptestValue::ANY) { + #[property_test] + fn test_can_fit_sequence_of_finite_value_with_lossless_error_bound(value: Value) { can_fit_sequence_of_value_within_error_bound(ErrorBound::Lossless, value) } - } #[test] fn test_can_fit_sequence_of_positive_infinity_with_lossless_error_bound() { @@ -151,14 +148,15 @@ mod tests { } } - proptest! { - #[test] - fn test_can_fit_one_value_with_lossless_error_bound(value in ProptestValue::ANY) { + #[property_test] + fn test_can_fit_one_value_with_lossless_error_bound(value: Value) { prop_assert!(PMCMean::new(ErrorBound::Lossless).fit_value(value)); } - #[test] - fn test_cannot_fit_other_value_and_positive_infinity_with_absolute_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_other_value_and_positive_infinity_with_absolute_error_bound_max( + value: Value, + ) { prop_assume!(value != Value::INFINITY); let error_bound_max = ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(); let mut model_type = PMCMean::new(error_bound_max); @@ -166,8 +164,10 @@ mod tests { prop_assert!(!model_type.fit_value(Value::INFINITY)); } - #[test] - fn test_cannot_fit_other_value_and_positive_infinity_with_relative_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_other_value_and_positive_infinity_with_relative_error_bound_max( + value: Value, + ) { prop_assume!(value != Value::INFINITY); let error_bound_max = ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(); let mut model_type = PMCMean::new(error_bound_max); @@ -175,8 +175,10 @@ mod tests { prop_assert!(!model_type.fit_value(Value::INFINITY)); } - #[test] - fn test_cannot_fit_other_value_and_negative_infinity_with_absolute_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_other_value_and_negative_infinity_with_absolute_error_bound_max( + value: Value, + ) { prop_assume!(value != Value::NEG_INFINITY); let error_bound_max = ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(); let mut model_type = PMCMean::new(error_bound_max); @@ -184,8 +186,10 @@ mod tests { prop_assert!(!model_type.fit_value(Value::NEG_INFINITY)); } - #[test] - fn test_cannot_fit_other_value_and_negative_infinity_with_relative_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_other_value_and_negative_infinity_with_relative_error_bound_max( + value: Value, + ) { prop_assume!(value != Value::NEG_INFINITY); let error_bound_max = ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(); let mut model_type = PMCMean::new(error_bound_max); @@ -193,8 +197,8 @@ mod tests { prop_assert!(!model_type.fit_value(Value::NEG_INFINITY)); } - #[test] - fn test_cannot_fit_other_value_and_nan_with_absolute_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_other_value_and_nan_with_absolute_error_bound_max(value: Value) { prop_assume!(!value.is_nan()); let error_bound_max = ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(); let mut model_type = PMCMean::new(error_bound_max); @@ -202,8 +206,8 @@ mod tests { prop_assert!(!model_type.fit_value(Value::NAN)); } - #[test] - fn test_cannot_fit_other_value_and_nan_with_relative_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_other_value_and_nan_with_relative_error_bound_max(value: Value) { prop_assume!(!value.is_nan()); let error_bound_max = ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(); let mut model_type = PMCMean::new(error_bound_max); @@ -211,8 +215,10 @@ mod tests { prop_assert!(!model_type.fit_value(Value::NAN)); } - #[test] - fn test_cannot_fit_positive_infinity_and_other_value_with_absolute_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_positive_infinity_and_other_value_with_absolute_error_bound_max( + value: Value, + ) { prop_assume!(value != Value::INFINITY); let error_bound_max = ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(); let mut model_type = PMCMean::new(error_bound_max); @@ -220,8 +226,10 @@ mod tests { prop_assert!(!model_type.fit_value(value)); } - #[test] - fn test_cannot_fit_positive_infinity_and_other_value_with_relative_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_positive_infinity_and_other_value_with_relative_error_bound_max( + value: Value, + ) { prop_assume!(value != Value::INFINITY); let error_bound_max = ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(); let mut model_type = PMCMean::new(error_bound_max); @@ -229,8 +237,10 @@ mod tests { prop_assert!(!model_type.fit_value(value)); } - #[test] - fn test_cannot_fit_negative_infinity_and_other_value_with_absolute_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_negative_infinity_and_other_value_with_absolute_error_bound_max( + value: Value, + ) { prop_assume!(value != Value::NEG_INFINITY); let error_bound_max = ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(); let mut model_type = PMCMean::new(error_bound_max); @@ -238,8 +248,10 @@ mod tests { prop_assert!(!model_type.fit_value(value)); } - #[test] - fn test_cannot_fit_negative_infinity_and_other_value_with_relative_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_negative_infinity_and_other_value_with_relative_error_bound_max( + value: Value, + ) { prop_assume!(value != Value::NEG_INFINITY); let error_bound_max = ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(); let mut model_type = PMCMean::new(error_bound_max); @@ -247,8 +259,8 @@ mod tests { prop_assert!(!model_type.fit_value(value)); } - #[test] - fn test_cannot_fit_nan_and_other_value_with_absolute_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_nan_and_other_value_with_absolute_error_bound_max(value: Value) { prop_assume!(!value.is_nan()); let error_bound_max = ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(); let mut model_type = PMCMean::new(error_bound_max); @@ -256,15 +268,14 @@ mod tests { prop_assert!(!model_type.fit_value(value)); } - #[test] - fn test_cannot_fit_nan_and_other_value_with_relative_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_nan_and_other_value_with_relative_error_bound_max(value: Value) { prop_assume!(!value.is_nan()); let error_bound_max = ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(); let mut model_type = PMCMean::new(error_bound_max); prop_assert!(model_type.fit_value(Value::NAN)); prop_assert!(!model_type.fit_value(value)); } - } #[test] fn test_cannot_fit_sequence_of_different_values_with_lossless_error_bound() { @@ -299,38 +310,36 @@ mod tests { } // Tests for sum(). - proptest! { - #[test] - fn test_sum(value in ProptestValue::ANY) { - prop_assert!(models::equal_or_nan(sum(10, value) as f64, (10.0 * value) as f64)); - } + #[property_test] + fn test_sum(value: Value) { + prop_assert!(models::equal_or_nan( + sum(10, value) as f64, + (10.0 * value) as f64 + )); } // Tests for grid(). - proptest! { - #[test] - fn test_grid(value in ProptestValue::ANY) { + #[property_test] + fn test_grid(value: Value) { let sampling_interval: i64 = 60; let timestamps: Vec = (60..=600).step_by(60).collect(); let mut value_builder = ValueBuilder::with_capacity(10); - grid( - value, - ×tamps, - &mut value_builder, - ); + grid(value, ×tamps, &mut value_builder); let values = value_builder.finish(); + prop_assert!(timestamps.len() == 10 && timestamps.len() == values.len()); prop_assert!( - timestamps.len() == 10 && timestamps.len() == values.len() + timestamps + .windows(2) + .all(|window| window[1] - window[0] == sampling_interval) + ); + prop_assert!( + values.iter().all(|value_option| models::equal_or_nan( + value_option.unwrap() as f64, + value as f64 + )) ); - prop_assert!(timestamps - .windows(2) - .all(|window| window[1] - window[0] == sampling_interval)); - prop_assert!(values - .iter() - .all(|value_option| models::equal_or_nan(value_option.unwrap() as f64, value as f64))); - } } } diff --git a/crates/modelardb_compression/src/models/swing.rs b/crates/modelardb_compression/src/models/swing.rs index ded61733d..88d6e6425 100644 --- a/crates/modelardb_compression/src/models/swing.rs +++ b/crates/modelardb_compression/src/models/swing.rs @@ -351,8 +351,7 @@ mod tests { use modelardb_types::schemas::COMPRESSED_SCHEMA; use modelardb_types::types::{TimestampArray, TimestampBuilder, ValueArray, ValueBuilder}; use proptest::num::f32 as ProptestValue; - use proptest::strategy::Strategy; - use proptest::{num, prop_assert, prop_assert_eq, prop_assume, proptest}; + use proptest::{num, prop_assert, prop_assert_eq, prop_assume, property_test}; use crate::models::SWING_ID; @@ -363,13 +362,9 @@ mod tests { const SEGMENT_LENGTH: Timestamp = 5; // Timestamp is used to remove casts. // Tests for Swing. - proptest! { - #[test] - fn test_can_fit_sequence_of_finite_value_with_lossless_error_bound(value in ProptestValue::ANY) { - can_fit_sequence_of_value_with_error_bound( - ErrorBound::Lossless, - value) - } + #[property_test] + fn test_can_fit_sequence_of_finite_value_with_lossless_error_bound(value: Value) { + can_fit_sequence_of_value_with_error_bound(ErrorBound::Lossless, value) } #[test] @@ -411,24 +406,25 @@ mod tests { } } - proptest! { - #[test] - fn test_can_fit_one_value_with_lossless_error_bound(value in ProptestValue::ANY) { + #[property_test] + fn test_can_fit_one_value_with_lossless_error_bound(value: Value) { prop_assert!(Swing::new(ErrorBound::Lossless).fit_data_point(START_TIME, value)); } - #[test] + #[property_test] fn test_can_fit_two_finite_value_with_lossless_error_bound( - first_value in ProptestValue::NORMAL, - second_value in ProptestValue::NORMAL + #[strategy = ProptestValue::NORMAL] first_value: Value, + #[strategy = ProptestValue::NORMAL] second_value: Value, ) { let mut model_type = Swing::new(ErrorBound::Lossless); prop_assert!(model_type.fit_data_point(START_TIME, first_value)); prop_assert!(model_type.fit_data_point(END_TIME, second_value)); } - #[test] - fn test_cannot_fit_other_value_and_positive_infinity_with_absolute_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_other_value_and_positive_infinity_with_absolute_error_bound_max( + value: Value, + ) { prop_assume!(value != Value::INFINITY); let error_bound_max = ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(); let mut model_type = Swing::new(error_bound_max); @@ -436,8 +432,10 @@ mod tests { prop_assert!(!model_type.fit_data_point(END_TIME, Value::INFINITY)); } - #[test] - fn test_cannot_fit_other_value_and_positive_infinity_with_relative_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_other_value_and_positive_infinity_with_relative_error_bound_max( + value: Value, + ) { prop_assume!(value != Value::INFINITY); let error_bound_max = ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(); let mut model_type = Swing::new(error_bound_max); @@ -445,8 +443,10 @@ mod tests { prop_assert!(!model_type.fit_data_point(END_TIME, Value::INFINITY)); } - #[test] - fn test_cannot_fit_other_value_and_negative_infinity_with_absolute_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_other_value_and_negative_infinity_with_absolute_error_bound_max( + value: Value, + ) { prop_assume!(value != Value::NEG_INFINITY); let error_bound_max = ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(); let mut model_type = Swing::new(error_bound_max); @@ -454,8 +454,10 @@ mod tests { prop_assert!(!model_type.fit_data_point(END_TIME, Value::NEG_INFINITY)); } - #[test] - fn test_cannot_fit_other_value_and_negative_infinity_with_relative_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_other_value_and_negative_infinity_with_relative_error_bound_max( + value: Value, + ) { prop_assume!(value != Value::NEG_INFINITY); let error_bound_max = ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(); let mut model_type = Swing::new(error_bound_max); @@ -463,8 +465,8 @@ mod tests { prop_assert!(!model_type.fit_data_point(END_TIME, Value::NEG_INFINITY)); } - #[test] - fn test_cannot_fit_other_value_and_nan_with_absolute_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_other_value_and_nan_with_absolute_error_bound_max(value: Value) { prop_assume!(!value.is_nan()); let error_bound_max = ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(); let mut model_type = Swing::new(error_bound_max); @@ -472,8 +474,8 @@ mod tests { prop_assert!(!model_type.fit_data_point(END_TIME, Value::NAN)); } - #[test] - fn test_cannot_fit_other_value_and_nan_with_relative_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_other_value_and_nan_with_relative_error_bound_max(value: Value) { prop_assume!(!value.is_nan()); let error_bound_max = ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(); let mut model_type = Swing::new(error_bound_max); @@ -481,8 +483,10 @@ mod tests { prop_assert!(!model_type.fit_data_point(END_TIME, Value::NAN)); } - #[test] - fn test_cannot_fit_positive_infinity_and_other_value_with_absolute_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_positive_infinity_and_other_value_with_absolute_error_bound_max( + value: Value, + ) { prop_assume!(value != Value::INFINITY); let error_bound_max = ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(); let mut model_type = Swing::new(error_bound_max); @@ -490,8 +494,10 @@ mod tests { prop_assert!(!model_type.fit_data_point(END_TIME, value)); } - #[test] - fn test_cannot_fit_positive_infinity_and_other_value_with_relative_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_positive_infinity_and_other_value_with_relative_error_bound_max( + value: Value, + ) { prop_assume!(value != Value::INFINITY); let error_bound_max = ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(); let mut model_type = Swing::new(error_bound_max); @@ -499,8 +505,10 @@ mod tests { prop_assert!(!model_type.fit_data_point(END_TIME, value)); } - #[test] - fn test_cannot_fit_negative_infinity_and_other_value_with_absolute_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_negative_infinity_and_other_value_with_absolute_error_bound_max( + value: Value, + ) { prop_assume!(value != Value::NEG_INFINITY); let error_bound_max = ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(); let mut model_type = Swing::new(error_bound_max); @@ -508,8 +516,10 @@ mod tests { prop_assert!(!model_type.fit_data_point(END_TIME, value)); } - #[test] - fn test_cannot_fit_negative_infinity_and_other_value_with_relative_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_negative_infinity_and_other_value_with_relative_error_bound_max( + value: Value, + ) { prop_assume!(value != Value::NEG_INFINITY); let error_bound_max = ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(); let mut model_type = Swing::new(error_bound_max); @@ -517,8 +527,8 @@ mod tests { prop_assert!(!model_type.fit_data_point(END_TIME, value)); } - #[test] - fn test_cannot_fit_nan_and_other_value_with_absolute_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_nan_and_other_value_with_absolute_error_bound_max(value: Value) { prop_assume!(!value.is_nan()); let error_bound_max = ErrorBound::try_new_absolute(ERROR_BOUND_ABSOLUTE_MAX).unwrap(); let mut model_type = Swing::new(error_bound_max); @@ -526,15 +536,14 @@ mod tests { prop_assert!(!model_type.fit_data_point(END_TIME, value)); } - #[test] - fn test_cannot_fit_nan_and_other_value_with_relative_error_bound_max(value in ProptestValue::ANY) { + #[property_test] + fn test_cannot_fit_nan_and_other_value_with_relative_error_bound_max(value: Value) { prop_assume!(!value.is_nan()); let error_bound_max = ErrorBound::try_new_relative(ERROR_BOUND_RELATIVE_MAX).unwrap(); let mut model_type = Swing::new(error_bound_max); prop_assert!(model_type.fit_data_point(START_TIME, Value::NAN)); prop_assert!(!model_type.fit_data_point(END_TIME, value)); } - } #[test] fn test_can_fit_sequence_of_linear_values_with_lossless_error_bound() { @@ -665,23 +674,21 @@ mod tests { } // Tests for sum(). - proptest! { - #[test] + #[property_test] fn test_sum( - first_value in num::i32::ANY.prop_map(i32_to_value), - last_value in num::i32::ANY.prop_map(i32_to_value), + #[strategy = num::i32::ANY.prop_map(i32_to_value)] first_value: Value, + #[strategy = num::i32::ANY.prop_map(i32_to_value)] last_value: Value, ) { let sum = sum(START_TIME, END_TIME, &[], first_value, last_value, 0); prop_assert_eq!(sum, first_value + last_value); } - } // Tests for grid(). - proptest! { - #[test] - fn test_grid(value in num::i32::ANY.prop_map(i32_to_value)) { - let timestamps: Vec = (START_TIME ..= END_TIME) - .step_by(SAMPLING_INTERVAL as usize).collect(); + #[property_test] + fn test_grid(#[strategy = num::i32::ANY.prop_map(i32_to_value)] value: Value) { + let timestamps: Vec = (START_TIME..=END_TIME) + .step_by(SAMPLING_INTERVAL as usize) + .collect(); let mut value_builder = ValueBuilder::with_capacity(timestamps.len()); // The linear function represents a constant to have a known value. @@ -697,13 +704,17 @@ mod tests { let values = value_builder.finish(); prop_assert!(timestamps.len() == values.len()); - prop_assert!(timestamps - .windows(2) - .all(|window| window[1] - window[0] == SAMPLING_INTERVAL)); - prop_assert!(values - .iter() - .all(|value_option| models::equal_or_nan(value_option.unwrap() as f64, value as f64))); - } + prop_assert!( + timestamps + .windows(2) + .all(|window| window[1] - window[0] == SAMPLING_INTERVAL) + ); + prop_assert!( + values.iter().all(|value_option| models::equal_or_nan( + value_option.unwrap() as f64, + value as f64 + )) + ); } fn i32_to_value(index: i32) -> Value { diff --git a/crates/modelardb_compression/src/models/timestamps.rs b/crates/modelardb_compression/src/models/timestamps.rs index 1d2264ca7..3634d682f 100644 --- a/crates/modelardb_compression/src/models/timestamps.rs +++ b/crates/modelardb_compression/src/models/timestamps.rs @@ -297,7 +297,7 @@ mod tests { use modelardb_test::data_generation; use proptest::num::i64 as ProptestTimestamp; - use proptest::{collection, proptest}; + use proptest::{collection, property_test}; // Tests for compress_residual_timestamps() and decompress_all_timestamps(). #[test] @@ -416,13 +416,13 @@ mod tests { compress_and_decompress_timestamps_for_a_time_series(timestamps.values(), None); } - proptest! { - #[test] - fn test_compress_and_decompress_timestamps_for_a_random_irregular_time_series(timestamps in collection::vec(ProptestTimestamp::ANY, 1..50)) { + #[property_test] + fn test_compress_and_decompress_timestamps_for_a_random_irregular_time_series( + #[strategy = collection::vec(ProptestTimestamp::ANY, 1..50)] timestamps: Vec, + ) { let mut timestamps = timestamps.iter().map(|ts| ts.abs()).collect::>(); timestamps.sort(); compress_and_decompress_timestamps_for_a_time_series(×tamps, None); - } } fn compress_and_decompress_timestamps_for_a_time_series( diff --git a/crates/modelardb_server/src/storage/uncompressed_data_buffer.rs b/crates/modelardb_server/src/storage/uncompressed_data_buffer.rs index f573fe11a..4835613fa 100644 --- a/crates/modelardb_server/src/storage/uncompressed_data_buffer.rs +++ b/crates/modelardb_server/src/storage/uncompressed_data_buffer.rs @@ -422,7 +422,7 @@ mod tests { use modelardb_test::table::{self, TIME_SERIES_TABLE_NAME}; use object_store::local::LocalFileSystem; use proptest::num::u64 as ProptestTimestamp; - use proptest::{collection, proptest}; + use proptest::{collection, property_test}; use tempfile::TempDir; use tokio::runtime::Runtime; @@ -570,9 +570,10 @@ mod tests { assert_eq!(data.schema(), time_series_table_metadata.schema); } - proptest! { - #[test] - fn test_record_batch_from_in_memory_data_buffer_is_sorted(timestamps in collection::vec(ProptestTimestamp::ANY, 1..50)) { + #[property_test] + fn test_record_batch_from_in_memory_data_buffer_is_sorted( + #[strategy = collection::vec(ProptestTimestamp::ANY, 1..50)] timestamps: Vec, + ) { // tokio::test is not supported in proptest! due to proptest-rs/proptest/issues/179. let runtime = Runtime::new().unwrap(); @@ -588,14 +589,24 @@ mod tests { // u64 is generated and then cast to i64 to ensure only positive values are generated. let values: &[Value] = &[37.0, 73.0]; for timestamp in timestamps { - uncompressed_buffer.insert_data_point(CURRENT_BATCH_INDEX, timestamp as i64, &mut values.iter().copied()); + uncompressed_buffer.insert_data_point( + CURRENT_BATCH_INDEX, + timestamp as i64, + &mut values.iter().copied(), + ); } - let data = runtime.block_on(uncompressed_buffer.record_batch()).unwrap(); + let data = runtime + .block_on(uncompressed_buffer.record_batch()) + .unwrap(); assert_eq!(data.schema(), time_series_table_metadata.schema); let timestamps = modelardb_types::array!(data, 0, TimestampArray); - assert!(timestamps.values().windows(2).all(|pair| pair[0] <= pair[1])); - } + assert!( + timestamps + .values() + .windows(2) + .all(|pair| pair[0] <= pair[1]) + ); } #[tokio::test] @@ -672,8 +683,10 @@ mod tests { assert!(!spilled_buffer_path.exists()); } - proptest! { - #[test] fn test_record_batch_from_on_disk_data_buffer_is_sorted(timestamps in collection::vec(ProptestTimestamp::ANY, 1..50)) { + #[property_test] + fn test_record_batch_from_on_disk_data_buffer_is_sorted( + #[strategy = collection::vec(ProptestTimestamp::ANY, 1..50)] timestamps: Vec, + ) { // tokio::test is not supported in proptest! due to proptest-rs/proptest/issues/179. let runtime = Runtime::new().unwrap(); @@ -689,28 +702,46 @@ mod tests { // u64 is generated and then cast to i64 to ensure only positive values are generated. let values: &[Value] = &[37.0, 73.0]; for timestamp in timestamps { - uncompressed_in_memory_buffer.insert_data_point(CURRENT_BATCH_INDEX, timestamp as i64, &mut values.iter().copied()); + uncompressed_in_memory_buffer.insert_data_point( + CURRENT_BATCH_INDEX, + timestamp as i64, + &mut values.iter().copied(), + ); } let temp_dir = tempfile::tempdir().unwrap(); let object_store = Arc::new(LocalFileSystem::new_with_prefix(temp_dir.path()).unwrap()); - let uncompressed_on_disk_buffer = runtime.block_on(uncompressed_in_memory_buffer - .spill_to_apache_parquet(object_store.clone())) + let uncompressed_on_disk_buffer = runtime + .block_on(uncompressed_in_memory_buffer.spill_to_apache_parquet(object_store.clone())) .unwrap(); - let spilled_buffers = runtime.block_on(object_store.list(Some(&Path::from(UNCOMPRESSED_DATA_FOLDER))).collect::>()); + let spilled_buffers = runtime.block_on( + object_store + .list(Some(&Path::from(UNCOMPRESSED_DATA_FOLDER))) + .collect::>(), + ); assert_eq!(spilled_buffers.len(), 1); - let data = runtime.block_on(uncompressed_on_disk_buffer.record_batch()).unwrap(); + let data = runtime + .block_on(uncompressed_on_disk_buffer.record_batch()) + .unwrap(); assert_eq!(data.schema(), time_series_table_metadata.schema); let timestamps = modelardb_types::array!(data, 0, TimestampArray); - assert!(timestamps.values().windows(2).all(|pair| pair[0] <= pair[1])); + assert!( + timestamps + .values() + .windows(2) + .all(|pair| pair[0] <= pair[1]) + ); - let spilled_buffers = runtime.block_on(object_store.list(Some(&Path::from(UNCOMPRESSED_DATA_FOLDER))).collect::>()); + let spilled_buffers = runtime.block_on( + object_store + .list(Some(&Path::from(UNCOMPRESSED_DATA_FOLDER))) + .collect::>(), + ); assert_eq!(spilled_buffers.len(), 0); } - } #[tokio::test] async fn test_check_if_on_disk_data_buffer_is_unused() { diff --git a/crates/modelardb_types/src/types.rs b/crates/modelardb_types/src/types.rs index 9574cb399..0e0f7fc9e 100644 --- a/crates/modelardb_types/src/types.rs +++ b/crates/modelardb_types/src/types.rs @@ -435,8 +435,7 @@ mod tests { use super::*; use arrow::datatypes::{Field, TimestampMillisecondType}; - use proptest::num; - use proptest::proptest; + use proptest::property_test; use modelardb_test::table::{self, TIME_SERIES_TABLE_NAME}; use modelardb_test::{ERROR_BOUND_FIVE, ERROR_BOUND_ZERO}; @@ -689,16 +688,16 @@ mod tests { assert_absolute_error_bound_error(ERROR_BOUND_ZERO); } - proptest! { - #[test] - fn test_absolute_error_bound_can_be_any_positive_value(value in num::f32::POSITIVE) { - assert!(ErrorBound::try_new_absolute(value).is_ok()) - } + #[property_test] + fn test_absolute_error_bound_can_be_any_positive_value( + #[strategy = 0.0..=f32::MAX] value: f32, + ) { + assert!(ErrorBound::try_new_absolute(value).is_ok()) + } - #[test] - fn test_absolute_error_bound_cannot_be_negative(value in num::f32::NEGATIVE) { - assert_absolute_error_bound_error(value); - } + #[property_test] + fn test_absolute_error_bound_cannot_be_negative(#[strategy = f32::MIN..0.0] value: f32) { + assert_absolute_error_bound_error(value); } #[test] @@ -730,22 +729,22 @@ mod tests { assert_relative_error_bound_error(ERROR_BOUND_ZERO); } - proptest! { - #[test] - fn test_relative_error_bound_can_be_positive_if_less_than_one_hundred(percentage in num::f32::POSITIVE) { - if percentage <= 100.0 { - assert!(ErrorBound::try_new_relative(percentage).is_ok()) - } else { - assert_relative_error_bound_error(percentage); - } - } - - #[test] - fn test_relative_error_bound_cannot_be_negative(percentage in num::f32::NEGATIVE) { + #[property_test] + fn test_relative_error_bound_can_be_positive_if_less_than_one_hundred( + #[strategy = 0.0..=f32::MAX] percentage: f32, + ) { + if percentage <= 100.0 { + assert!(ErrorBound::try_new_relative(percentage).is_ok()) + } else { assert_relative_error_bound_error(percentage); } } + #[property_test] + fn test_relative_error_bound_cannot_be_negative(#[strategy = f32::MIN..0.0] percentage: f32) { + assert_relative_error_bound_error(percentage); + } + #[test] fn test_relative_error_bound_cannot_be_positive_infinity() { assert_relative_error_bound_error(f32::INFINITY); From c19550c96bd008213b0867a8f68b61874edc502d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Kejser=20Jensen?= Date: Sat, 22 Aug 2026 13:33:36 +0200 Subject: [PATCH 2/4] Update based on comments from @Copilot --- crates/modelardb_types/src/types.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/modelardb_types/src/types.rs b/crates/modelardb_types/src/types.rs index 0e0f7fc9e..8b4159031 100644 --- a/crates/modelardb_types/src/types.rs +++ b/crates/modelardb_types/src/types.rs @@ -690,7 +690,7 @@ mod tests { #[property_test] fn test_absolute_error_bound_can_be_any_positive_value( - #[strategy = 0.0..=f32::MAX] value: f32, + #[strategy = f32::MIN_POSITIVE..=f32::MAX] value: f32, ) { assert!(ErrorBound::try_new_absolute(value).is_ok()) } From 9ea68d880a947f3267a364abfeff51483a2e6bea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Kejser=20Jensen?= Date: Tue, 25 Aug 2026 11:31:09 +0200 Subject: [PATCH 3/4] Update outdated comment about lack of if-let chains --- .../modelardb_server/src/storage/uncompressed_data_manager.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/modelardb_server/src/storage/uncompressed_data_manager.rs b/crates/modelardb_server/src/storage/uncompressed_data_manager.rs index e1bd73d4e..f768307a4 100644 --- a/crates/modelardb_server/src/storage/uncompressed_data_manager.rs +++ b/crates/modelardb_server/src/storage/uncompressed_data_manager.rs @@ -247,7 +247,7 @@ impl UncompressedDataManager { ) .await?; - // Two ifs are needed until if-let chains is implemented in Rust stable, see eRFC 2497. + // If the buffer is on disk read it into memory, otherwise create an in-memory buffer. if let Some(tag_hash_buffer) = self.uncompressed_on_disk_data_buffers.get(&tag_hash) { let uncompressed_on_disk_data_buffer = tag_hash_buffer.value(); From 883e2f1ab312d280e42861896ebe64fd9459b62b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Kejser=20Jensen?= Date: Fri, 28 Aug 2026 08:42:01 +0200 Subject: [PATCH 4/4] Insert commas from @chrthomsen Co-authored-by: Christian Thomsen --- .../modelardb_server/src/storage/uncompressed_data_manager.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/modelardb_server/src/storage/uncompressed_data_manager.rs b/crates/modelardb_server/src/storage/uncompressed_data_manager.rs index f768307a4..2bb96441f 100644 --- a/crates/modelardb_server/src/storage/uncompressed_data_manager.rs +++ b/crates/modelardb_server/src/storage/uncompressed_data_manager.rs @@ -247,7 +247,7 @@ impl UncompressedDataManager { ) .await?; - // If the buffer is on disk read it into memory, otherwise create an in-memory buffer. + // If the buffer is on disk, read it into memory; otherwise create an in-memory buffer. if let Some(tag_hash_buffer) = self.uncompressed_on_disk_data_buffers.get(&tag_hash) { let uncompressed_on_disk_data_buffer = tag_hash_buffer.value();