Commit b6e801ce authored by Tom Zhao's avatar Tom Zhao
Browse files

xz1919: updated struct test cases with new grammar rule for struct creation

parent 01e6cfff
......@@ -5,5 +5,5 @@
begin
struct a is {int i, char j}
a x = new a {1}
a x = new a (1)
end
\ No newline at end of file
......@@ -5,5 +5,5 @@
begin
struct a is {int i}
a x = new a {'a'}
a x = new a ('a')
end
\ No newline at end of file
......@@ -5,6 +5,6 @@
begin
struct a is {int b}
a x = new a {1};
a x = new a (1);
println a.c
end
\ No newline at end of file
......@@ -5,5 +5,5 @@
begin
struct a is {int i}
a x = new a {}
a x = new a ()
end
\ No newline at end of file
......@@ -6,7 +6,7 @@
begin
struct a is {b b}
struct b is {int i}
a a = new a {null};
a.b = new b {1};
a a = new a (null);
a.b = new b (1);
println a.b.i
end
\ No newline at end of file
......@@ -4,5 +4,5 @@
# Program:
begin
a x = new a {}
a x = new a ()
end
\ No newline at end of file
......@@ -7,7 +7,7 @@ begin
struct a is {b b}
struct b is {int i}
a a = empty;
a = new a {empty};
a.b = new b {1};
a = new a (empty);
a.b = new b (1);
println a.b.i
end
\ No newline at end of file
......@@ -5,6 +5,6 @@
begin
struct a is {int i}
a x = new a {10};
a x = new a (10);
free x
end
\ No newline at end of file
......@@ -9,7 +9,7 @@
begin
struct a is {int i, b b}
struct b is {int j, a a}
a a = new a {1, new b {2, empty}};
a a = new a (1, new b (2, empty));
a.b.a = a;
println a.i;
println a.b.j;
......
......@@ -6,7 +6,7 @@
begin
struct a is {int i}
a x = new a {0};
a x = new a (0);
read x.i;
println x.i
end
\ No newline at end of file
......@@ -6,12 +6,12 @@
begin
struct node is {int i, node next}
int count = 0;
node start = new node {count, empty};
node start = new node (count, empty);
node cur = start;
count = count + 1;
while count <= 10 do
cur.next = new node {count, empty};
cur.next = new node (count, empty);
cur = cur.next;
count = count + 1
done;
......
......@@ -5,6 +5,6 @@
begin
struct a is {int value}
a x = new a{1};
a x = new a(1);
println x.value
end
\ No newline at end of file
......@@ -6,9 +6,9 @@
begin
struct a is {int b}
a a(int b) is return new a{b} end
a a(int b) is return new a(b) end
struct b is {int c}
b b(int c) is return new b{c} end
b b(int c) is return new b(c) end
a x = call a(1);
println x.b;
b y = call b(2);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment