fix test after syntax changes

This commit is contained in:
Torsten Ruger 2015-10-19 15:21:23 +03:00
parent 3061ddfed9
commit 6710567af9
15 changed files with 42 additions and 46 deletions

View File

@ -15,13 +15,13 @@ class String
my_length = str_len + my_length
new_string = self.new_string(my_length )
i = 0
while( i < my_length)
while_plus( i - my_length)
char = get(i)
new_string.set(i , char)
i = i + 1
end
i = 0
while( i < str_len)
while_plus( i - str_len)
char = str.get(i)
len = i + my_length
new_string.set( len , char)
@ -99,9 +99,9 @@ s(:statements,
s(:assignment,
s(:name, :i),
s(:int, 0)),
s(:while_statement,
s(:condition,
s(:operator_value, :<,
s(:while_statement, :plus,
s(:conditional,
s(:operator_value, :-,
s(:name, :i),
s(:name, :my_length))),
s(:statements,
@ -126,9 +126,9 @@ s(:statements,
s(:assignment,
s(:name, :i),
s(:int, 0)),
s(:while_statement,
s(:condition,
s(:operator_value, :<,
s(:while_statement, :plus,
s(:conditional,
s(:operator_value, :-,
s(:name, :i),
s(:name, :str_len))),
s(:statements,

View File

@ -17,7 +17,7 @@ s(:statements,
s(:parameters,
s(:parameter, :Integer, :n)),
s(:statements,
s(:if_statement,
s(:if_statement, :zero,
s(:condition,
s(:int, 0)),
s(:true_statements,

View File

@ -1,7 +1,7 @@
int fibonaccit(int n)
a = 0
b = 1
while( n > 1 )
while_positive( n )
tmp = a
a = b
b = tmp + b
@ -22,11 +22,9 @@ s(:statements,
s(:assignment,
s(:name, :b),
s(:int, 1)),
s(:while_statement,
s(:condition,
s(:operator_value, :>,
s(:name, :n),
s(:int, 1))),
s(:while_statement, :positive,
s(:conditional,
s(:name, :n)),
s(:statements,
s(:assignment,
s(:name, :tmp),

View File

@ -12,7 +12,7 @@ s(:statements,
s(:parameters,
s(:parameter, :Integer, :n)),
s(:statements,
s(:if_statement,
s(:if_statement, :plus,
s(:condition,
s(:int, 0)),
s(:true_statements,

View File

@ -12,9 +12,9 @@ s(:statements,
s(:parameters,
s(:parameter, :Integer, :n)),
s(:statements,
s(:if_statement,
s(:if_statement, :positive,
s(:condition,
s(:operator_value, :>,
s(:operator_value, :-,
s(:name, :n),
s(:int, 5))),
s(:true_statements,

View File

@ -1,5 +1,5 @@
int retvar(int n )
while( n > 5)
while_positive( n - 5)
n = n + 1
return n
end
@ -11,9 +11,9 @@ s(:statements,
s(:parameters,
s(:parameter, :Integer, :n)),
s(:statements,
s(:while_statement,
s(:condition,
s(:operator_value, :>,
s(:while_statement, :positive,
s(:conditional,
s(:operator_value, :-,
s(:name, :n),
s(:int, 5))),
s(:statements,

View File

@ -1,6 +1,6 @@
Biggie fibonaccit(int n)
a = 0
while(n)
while_ok(n)
some = 43
other = some * 4
end
@ -15,8 +15,8 @@ s(:statements,
s(:assignment,
s(:name, :a),
s(:int, 0)),
s(:while_statement,
s(:condition,
s(:while_statement, :ok,
s(:conditional,
s(:name, :n)),
s(:statements,
s(:assignment,

View File

@ -4,7 +4,7 @@ else
twenty = 5
end
-- -- --
s(:if_statement,
s(:if_statement, :true,
s(:condition,
s(:int, 0)),
s(:true_statements,

View File

@ -4,7 +4,7 @@ else
var.new(33)
end
-- -- --
s(:if_statement,
s(:if_statement, :yes,
s(:condition,
s(:operator_value, :>,
s(:int, 3),

View File

@ -2,7 +2,7 @@ class Object
int fibonaccit(int n)
a = 0
b = 1
while( n > 1 )
while_plus( n )
tmp = a
a = b
b = tmp + b
@ -31,11 +31,9 @@ s(:statements,
s(:assignment,
s(:name, :b),
s(:int, 1)),
s(:while_statement,
s(:condition,
s(:operator_value, :>,
s(:name, :n),
s(:int, 1))),
s(:while_statement, :plus,
s(:conditional,
s(:name, :n)),
s(:statements,
s(:assignment,
s(:name, :tmp),

View File

@ -2,7 +2,7 @@ if_zero(0)
four = 42
end
-- -- --
s(:if_statement,
s(:if_statement, :zero,
s(:condition,
s(:int, 0)),
s(:true_statements,

View File

@ -2,11 +2,11 @@ if_overflow(3 + 100000 )
Object.initialize(3)
end
-- -- --
s(:if_statement,
s(:if_statement, :overflow,
s(:condition,
s(:operator_value, :>,
s(:operator_value, :+,
s(:int, 3),
s(:name, :var))),
s(:int, 100000))),
s(:true_statements,
s(:call,
s(:name, :initialize),

View File

@ -1,4 +1,4 @@
while( n > 1)
while_allgood( n > 1)
tmp = a
a = b
b = tmp + b
@ -6,8 +6,8 @@ while( n > 1)
n = n - 1
end
-- -- --
s(:while_statement,
s(:condition,
s(:while_statement, :allgood,
s(:conditional,
s(:operator_value, :>,
s(:name, :n),
s(:int, 1))),

View File

@ -1,10 +1,10 @@
while(1)
while_false(1)
tmp = a
puts(b)
end
-- -- --
s(:while_statement,
s(:condition,
s(:while_statement, :false,
s(:conditional,
s(:int, 1)),
s(:statements,
s(:assignment,

View File

@ -1,10 +1,10 @@
while(1)
while_true(1)
tmp = String.new()
tmp.puts(i)
end
-- -- --
s(:while_statement,
s(:condition,
s(:while_statement, :true,
s(:conditional,
s(:int, 1)),
s(:statements,
s(:assignment,