macro_rules! test_set_constants {
($(
$var_name:ident = $val:expr;
)+) => { ... };
}Expand description
A macro for tests that sets HF_XET_<CONSTANT_NAME> to $value before
the constant is initialized, and then checks that the constant actually picks up
that value. If the constant was already accessed (thus initialized), or if it
doesn’t match after being set, this macro panics.
Typically you would document the macro itself here, rather than placing
doc comments above each call to test_set_constants!, because it doesn’t
define a new item.
§Example
use xet_runtime::{test_configurable_constants, test_set_constants};
test_configurable_constants! {
/// Target chunk size
ref CHUNK_TARGET_SIZE: u64 = 1024;
/// Max Chunk size, only adjustable in testing mode.
ref MAX_CHUNK_SIZE: u64 = 4096;
}
test_set_constants! {
CHUNK_TARGET_SIZE = 2048;
}
assert_eq!(*CHUNK_TARGET_SIZE, 2048);