Skip to content

Commit

Permalink
added missing tests (auto-cast int->float) (#189)
Browse files Browse the repository at this point in the history
Co-authored-by: Ghaith Hachem <ghaith.hachem@gmail.com>
  • Loading branch information
riederm and ghaith committed Jul 16, 2021
1 parent 9cf46dd commit 8ae702a
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/codegen/tests/code_gen_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,34 @@ END_PROGRAM
assert_eq!(result, expected);
}

#[test]
fn program_with_real_cast_assignment() {
let result = codegen!(
r#"PROGRAM prg
VAR
y : REAL;
x : INT;
END_VAR
y := x;
END_PROGRAM
"#
);
let expected = generate_program_boiler_plate(
"prg",
&[("float", "y"), ("i16", "x")],
"void",
"",
"",
r#"%load_x = load i16, i16* %x, align 2
%1 = sitofp i16 %load_x to float
store float %1, float* %y, align 4
ret void
"#,
);

assert_eq!(result, expected);
}

#[test]
fn program_with_date_assignment() {
let result = codegen!(
Expand Down

0 comments on commit 8ae702a

Please sign in to comment.