Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions crates/celox-test-suite/src/veryl/cases/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ pub(super) struct Group {
}

pub(super) const GROUPS: &[Group] = &[
Group {
file: "src/veryl/cases/tb_string.vtest",
text: include_str!("tb_string.vtest"),
},
Group {
file: "src/veryl/cases/partial_word_shift.vtest",
text: include_str!("partial_word_shift.vtest"),
Expand Down
79 changes: 79 additions & 0 deletions crates/celox-test-suite/src/veryl/cases/tb_string.vtest
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
(group tb_string (category control_flow))

(case assignment
(source "test.veryl" #"#[test(Top)]
module Top {
var text: string;
var copy: string;
initial {
text = "short";
$assert(text == "short");
copy = text;
text = "a string longer than sixty-four bits";
$assert(text == "a string longer than sixty-four bits");
$assert(copy == "short");
copy = text;
$assert(copy == text);
text = "x";
$assert(text == "x");
$assert(copy != text);
text = "";
$assert(text == "");
$assert(copy != text);
$finish();
}
}
"#)
(top Top)
(run_testbench))

(case comparison
(source "test.veryl" #"#[test(Top)]
module Top {
var left: string;
var right: string;
initial {
left = "b";
right = "aa";
$assert(left >: right);
$assert(left >= right);
$assert(right <: left);
$assert(right <= left);
$assert(left != right);
right = left;
$assert(left == right);
$assert(left <= right);
$assert(left >= right);
left = "";
$assert(left <: right);
$finish();
}
}
"#)
(top Top)
(run_testbench))

(case control_flow
(source "test.veryl" #"#[test(Top)]
module Top {
var text: string;
var choose: logic;
initial {
text = "before";
$assert(text == "before");
choose = 1;
text = if choose ? "longer branch value" : "no";
$assert(text == "longer branch value");
choose = 0;
text = if choose ? "no" : "";
$assert(text == "");
for i in 0..3 {
if i == 1 { text = "middle"; }
}
$assert(text == "middle");
$finish();
}
}
"#)
(top Top)
(run_testbench))
2 changes: 1 addition & 1 deletion crates/celox-test-suite/tests/external_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ fn catalogue_has_unique_stable_names_and_categories() {
assert!(names.insert(case.name), "duplicate {}", case.name);
assert!(case.name.contains("::"));
}
assert_eq!(names.len(), 757);
assert_eq!(names.len(), 760);
assert_eq!(
case("operators::test_bitwise_operations").unwrap().category,
Category::Operators
Expand Down
31 changes: 31 additions & 0 deletions crates/celox/tests/testbench_string.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#[path = "test_utils/mod.rs"]
#[macro_use]
#[allow(unused_macros)]
mod test_utils;

all_backends! {
fn tb_string_assignment(sim) {
@omit_veryl;
// Veryl does not emit #[test] modules into SystemVerilog.
// Celox currently truncates string assignments to the nominal one-bit width.
// All six Celox configurations fail these cases; the support PR enables them.
@ignore_on(native, cranelift, wasm, interp, sv);
@case "tb_string::assignment";
}
fn tb_string_comparison(sim) {
@omit_veryl;
// Veryl does not emit #[test] modules into SystemVerilog.
// Celox currently truncates string assignments to the nominal one-bit width.
// All six Celox configurations fail these cases; the support PR enables them.
@ignore_on(native, cranelift, wasm, interp, sv);
@case "tb_string::comparison";
}
fn tb_string_control_flow(sim) {
@omit_veryl;
// Veryl does not emit #[test] modules into SystemVerilog.
// Celox currently truncates string assignments to the nominal one-bit width.
// All six Celox configurations fail these cases; the support PR enables them.
@ignore_on(native, cranelift, wasm, interp, sv);
@case "tb_string::control_flow";
}
}
Loading