Skip to content

Commit

Permalink
Move the size test to a new Bazel target
Browse files Browse the repository at this point in the history
  • Loading branch information
oggy-dfin committed Oct 24, 2024
1 parent 4d37173 commit 0edfce8
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 21 deletions.
6 changes: 6 additions & 0 deletions rs/tla_instrumentation/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ rust_test(
],
)

rust_test(
name = "basic_tests",
srcs = ["tla_instrumentation/tests/basic_tests.rs"],
deps = [":tla_instrumentation"],
)

rust_test(
name = "multiple_calls_test",
srcs = [
Expand Down
23 changes: 23 additions & 0 deletions rs/tla_instrumentation/tla_instrumentation/tests/basic_tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use std::collections::BTreeMap;
use tla_instrumentation::{TlaValue, ToTla};

#[test]
fn size_test() {
let myval = TlaValue::Record(BTreeMap::from([
(
"field1".to_string(),
TlaValue::Function(BTreeMap::from([(
1_u64.to_tla_value(),
true.to_tla_value(),
)])),
),
(
"field2".to_string(),
TlaValue::Variant {
tag: "tag".to_string(),
value: Box::new("abc".to_tla_value()),
},
),
]));
assert_eq!(myval.size(), 6);
}
21 changes: 0 additions & 21 deletions rs/tla_instrumentation/tla_instrumentation/tests/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,27 +149,6 @@ impl StructCanister {
}
}

#[test]
fn size_test() {
let myval = TlaValue::Record(BTreeMap::from([
(
"field1".to_string(),
TlaValue::Function(BTreeMap::from([(
1_u64.to_tla_value(),
true.to_tla_value(),
)])),
),
(
"field2".to_string(),
TlaValue::Variant {
tag: "tag".to_string(),
value: Box::new("abc".to_tla_value()),
},
),
]));
assert_eq!(myval.size(), 6);
}

#[test]
fn struct_test() {
unsafe {
Expand Down

0 comments on commit 0edfce8

Please sign in to comment.