Skip to main content

diskann_tools/utils/
test_utils.rs

1/*
2 * Copyright (c) Microsoft Corporation.
3 * Licensed under the MIT license.
4 */
5
6#[cfg(not(miri))]
7pub mod size_constants {
8    /// The recommended dataset size for testing the library.
9    /// A prime number is used to avoid any accidental patterns in the data.
10    pub const TEST_DATASET_SIZE_RECOMMENDED: u64 = 991;
11
12    /// The small dataset size for testing the library.
13    /// A prime number is used to avoid any accidental patterns in the data.
14    pub const TEST_DATASET_SIZE_SMALL: u64 = 101;
15
16    /// The recommended query size for testing the library.
17    /// A prime number is used to avoid any accidental patterns in the data.
18    pub const TEST_QUERYSET_SIZE_RECOMMENDED: u64 = 101;
19
20    /// The small query size for testing the library.
21    /// A prime number is used to avoid any accidental patterns in the data.
22    pub const TEST_QUERYSET_SIZE_SMALL: u64 = 11;
23
24    /// The recommended number of dimensions for testing the library.
25    /// A prime number is used to avoid any accidental patterns in the data.
26    /// When "memory aligned" the dimensions become 64 (8*8). Setting to non-aligned value to ensure aligning works.
27    pub const TEST_NUM_DIMENSIONS_RECOMMENDED: usize = 59;
28
29    /// The recommended "memory aligned" number of dimensions for testing the library (64=8*8).
30    pub const TEST_NUM_DIMENSIONS_RECOMMENDED_MEMORY_ALIGNED: usize = 64;
31
32    /// The small number of dimensions for testing the library.
33    /// A prime number is used to avoid any accidental patterns in the data.
34    pub const TEST_NUM_DIMENSIONS_SMALL: usize = 13;
35
36    /// The small "memory aligned" number of dimensions for testing the library.
37    pub const TEST_NUM_DIMENSIONS_SMALL_MEMORY_ALIGNED: usize = 16;
38}
39
40#[cfg(miri)]
41pub mod size_constants {
42    /// The recommended dataset size for testing the library.
43    /// A prime number is used to avoid any accidental patterns in the data.
44    pub const TEST_DATASET_SIZE_RECOMMENDED: u64 = 7;
45
46    /// The small dataset size for testing the library.
47    /// A prime number is used to avoid any accidental patterns in the data.
48    pub const TEST_DATASET_SIZE_SMALL: u64 = 3;
49
50    /// The recommended query size for testing the library.
51    /// A prime number is used to avoid any accidental patterns in the data.
52    pub const TEST_QUERYSET_SIZE_RECOMMENDED: u64 = 3;
53
54    /// The small query size for testing the library.
55    /// A prime number is used to avoid any accidental patterns in the data.
56    pub const TEST_QUERYSET_SIZE_SMALL: u64 = 1;
57
58    /// The recommended number of dimensions for testing the library.
59    /// A prime number is used to avoid any accidental patterns in the data.
60    /// When "memory aligned" the dimensions become 16 (8*2). Setting to non-aligned value to ensure aligning works.
61    pub const TEST_NUM_DIMENSIONS_RECOMMENDED: usize = 13;
62
63    /// The recommended "memory aligned" number of dimensions for testing the library (16=8*2).
64    pub const TEST_NUM_DIMENSIONS_RECOMMENDED_MEMORY_ALIGNED: usize = 16;
65
66    /// The small number of dimensions for testing the library.
67    /// A prime number is used to avoid any accidental patterns in the data.
68    pub const TEST_NUM_DIMENSIONS_SMALL: usize = 7;
69
70    /// The small "memory aligned" number of dimensions for testing the library.
71    pub const TEST_NUM_DIMENSIONS_SMALL_MEMORY_ALIGNED: usize = 8;
72}