mirror of
https://github.com/edg-l/edlang.git
synced 2024-11-21 23:48:24 +00:00
test
This commit is contained in:
parent
ccc70b9122
commit
314750a3b5
|
@ -9,6 +9,7 @@ mod common;
|
|||
#[test_case(include_str!("programs/while.ed"), "while", false, 10, &[] ; "r#while")]
|
||||
#[test_case(include_str!("programs/factorial.ed"), "factorial", false, 24, &[] ; "factorial")]
|
||||
#[test_case(include_str!("programs/refs.ed"), "refs", false, 2, &[] ; "refs")]
|
||||
#[test_case(include_str!("programs/struct.ed"), "struct", false, 5, &[] ; "r#struct")]
|
||||
#[test_case(TEST_ADD, "TEST_ADD", false, 2, &[] ; "TEST_ADD")]
|
||||
#[test_case(TEST_SUB, "TEST_SUB", false, 1, &[] ; "TEST_SUB")]
|
||||
#[test_case(TEST_MUL, "TEST_MUL", false, 4, &[] ; "TEST_MUL")]
|
||||
|
|
20
lib/edlang_driver/tests/programs/struct.ed
Normal file
20
lib/edlang_driver/tests/programs/struct.ed
Normal file
|
@ -0,0 +1,20 @@
|
|||
mod Main {
|
||||
|
||||
struct Hello {
|
||||
a: i32,
|
||||
b: i64,
|
||||
}
|
||||
|
||||
pub fn main() -> i64 {
|
||||
let x: Hello = Hello {
|
||||
a: 2,
|
||||
b: 3,
|
||||
};
|
||||
hello(&mut x);
|
||||
return x.b;
|
||||
}
|
||||
|
||||
pub fn hello(a: &mut Hello) {
|
||||
a.b = 5;
|
||||
}
|
||||
}
|
20
programs/struct.ed
Normal file
20
programs/struct.ed
Normal file
|
@ -0,0 +1,20 @@
|
|||
mod Main {
|
||||
|
||||
struct Hello {
|
||||
a: i32,
|
||||
b: i64,
|
||||
}
|
||||
|
||||
pub fn main() -> i64 {
|
||||
let x: Hello = Hello {
|
||||
a: 2,
|
||||
b: 3,
|
||||
};
|
||||
hello(&mut x);
|
||||
return x.b;
|
||||
}
|
||||
|
||||
pub fn hello(a: &mut Hello) {
|
||||
a.b = 5;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue