Files
nunuhara_xsystem4/test/Source/structs.jaf
T
Nunuhara Cabbage 7ba5626675 Support simple struct/class usage
No constructors, destructors or methods--just simple data structures.
2019-10-19 08:18:22 -07:00

25 lines
574 B
C
Executable File

// -*-mode: C; coding: sjis; -*-
struct inner_struct {
int a;
};
struct my_struct {
int a;
int b;
string s;
inner_struct inner;
};
void test_structs(void)
{
my_struct s;
test_equal("s.a (uninitialized)", s.a, 0);
test_string("s.s (uninitialized)", s.s, "");
test_equal("s.inner.a (uninitialized)", s.inner.a, 0);
test_equal("s.a = 12", (s.a = 12, s.a), 12);
test_equal("s.b = 13", (s.b = 13, s.b), 13);
test_bool("s.s = \"test\"", (s.s = "test", s.s == "test"), true);
test_equal("s.inner.a = 14", (s.inner.a = 14, s.inner.a), 14);
}