Update model solution.

- Stop calculating operands for & operators.
- Evaluate the lhs of compound operators only once.
- Add `side-effect.c` example.
This commit is contained in:
Jaewoo Kim
2025-04-07 11:03:18 +00:00
parent 7a95032d43
commit 32283f2ed1
26 changed files with 331 additions and 210 deletions

View File

@@ -60,6 +60,9 @@ const IRGEN_SMALL_TEST_IGNORE_LIST: [&str; 12] = [
"examples/c/temp2.c",
];
// TODO: Enable this test next semester.
const IRGEN_FULL_TEST_IGNORE_LIST: [&str; 1] = ["examples/c/side-effect.c"];
const ASMGEN_TEST_DIR_LIST: [&str; 5] = [
"examples/ir0",
"examples/ir1",
@@ -101,7 +104,10 @@ fn test_examples_irgen_small() {
test_irgen(Path::new(&format!("examples/c/{HELLO_MAIN}.c")));
test_dir(Path::new("examples/c"), OsStr::new("c"), |path| {
let path_str = &path.to_str().expect("`path` must be transformed to `&str`");
if !IRGEN_SMALL_TEST_IGNORE_LIST.contains(path_str) && !path_str.contains(HELLO_MAIN) {
if !IRGEN_SMALL_TEST_IGNORE_LIST.contains(path_str)
&& !IRGEN_FULL_TEST_IGNORE_LIST.contains(path_str)
&& !path_str.contains(HELLO_MAIN)
{
println!("[testing irgen for {path:?}]");
test_irgen(path);
}