Removing preloads from mains tests
Instead of loading all preload for all tests, adding just those functions that are needed for each. Should reduce test times. Also renaming tests to give some indication of difficulty. Alas they are not run in that order.
This commit is contained in:
10
test/mains/source/10_add__4.rb
Normal file
10
test/mains/source/10_add__4.rb
Normal file
@ -0,0 +1,10 @@
|
||||
class Integer < Data4
|
||||
def +(right)
|
||||
X.int_operator(:+)
|
||||
end
|
||||
end
|
||||
class Space
|
||||
def main(arg)
|
||||
return 2 + 2
|
||||
end
|
||||
end
|
@ -1,3 +1,8 @@
|
||||
class Integer < Data4
|
||||
def -(right)
|
||||
X.int_operator(:-)
|
||||
end
|
||||
end
|
||||
class Space
|
||||
def same( n )
|
||||
return n
|
@ -1,3 +1,8 @@
|
||||
class Integer < Data4
|
||||
def +(right)
|
||||
X.int_operator(:+)
|
||||
end
|
||||
end
|
||||
class Space
|
||||
def self.simple
|
||||
return 2 + 2
|
@ -1,3 +1,8 @@
|
||||
class Word < Data8
|
||||
def putstring
|
||||
X.putstring
|
||||
end
|
||||
end
|
||||
class Class < Behaviour
|
||||
def name
|
||||
@name
|
@ -1,3 +1,8 @@
|
||||
class Word < Data8
|
||||
def putstring
|
||||
X.putstring
|
||||
end
|
||||
end
|
||||
class Space
|
||||
def main(arg)
|
||||
return "Hello-there".putstring
|
@ -1,3 +1,13 @@
|
||||
class Integer < Data4
|
||||
def <(right)
|
||||
X.comparison(:<)
|
||||
end
|
||||
end
|
||||
class Word < Data8
|
||||
def putstring
|
||||
X.putstring
|
||||
end
|
||||
end
|
||||
class Space
|
||||
def if_small( n )
|
||||
if( n < 10)
|
@ -1,3 +1,13 @@
|
||||
class Integer < Data4
|
||||
def <(right)
|
||||
X.comparison(:<)
|
||||
end
|
||||
end
|
||||
class Word < Data8
|
||||
def putstring
|
||||
X.putstring
|
||||
end
|
||||
end
|
||||
class Space
|
||||
def if_small( n )
|
||||
if( n < 10)
|
@ -1,3 +1,11 @@
|
||||
class Integer < Data4
|
||||
def <(right)
|
||||
X.comparison(:<)
|
||||
end
|
||||
def -(right)
|
||||
X.int_operator(:-)
|
||||
end
|
||||
end
|
||||
class Space
|
||||
|
||||
def down( n )
|
@ -1,3 +1,11 @@
|
||||
class Integer < Data4
|
||||
def <(right)
|
||||
X.comparison(:<)
|
||||
end
|
||||
def +(right)
|
||||
X.int_operator(:+)
|
||||
end
|
||||
end
|
||||
class Space
|
||||
def main(arg)
|
||||
n = 6
|
18
test/mains/source/31_while__0.rb
Normal file
18
test/mains/source/31_while__0.rb
Normal file
@ -0,0 +1,18 @@
|
||||
class Integer < Data4
|
||||
def >=(right)
|
||||
X.comparison(:>=)
|
||||
end
|
||||
def -(right)
|
||||
X.int_operator(:-)
|
||||
end
|
||||
end
|
||||
|
||||
class Space
|
||||
def main(arg)
|
||||
b = 10
|
||||
while( b >= 1 )
|
||||
b = b - 1
|
||||
end
|
||||
return b
|
||||
end
|
||||
end
|
22
test/mains/source/32_adds__10.rb
Normal file
22
test/mains/source/32_adds__10.rb
Normal file
@ -0,0 +1,22 @@
|
||||
class Integer < Data4
|
||||
def <(right)
|
||||
X.comparison(:<)
|
||||
end
|
||||
def +(right)
|
||||
X.int_operator(:+)
|
||||
end
|
||||
def -(right)
|
||||
X.int_operator(:-)
|
||||
end
|
||||
end
|
||||
class Space
|
||||
def main(arg)
|
||||
a = 0
|
||||
b = 20
|
||||
while( a < b )
|
||||
a = a + 1
|
||||
b = b - 1
|
||||
end
|
||||
return a
|
||||
end
|
||||
end
|
@ -1,3 +1,15 @@
|
||||
class Integer < Data4
|
||||
def <(right)
|
||||
X.comparison(:<)
|
||||
end
|
||||
def +(right)
|
||||
X.int_operator(:+)
|
||||
end
|
||||
def -(right)
|
||||
X.int_operator(:-)
|
||||
end
|
||||
end
|
||||
|
||||
class Space
|
||||
|
||||
def fibo_r( n )
|
@ -1,3 +1,16 @@
|
||||
class Integer < Data4
|
||||
def <(right)
|
||||
X.comparison(:<)
|
||||
end
|
||||
def +(right)
|
||||
X.int_operator(:+)
|
||||
end
|
||||
end
|
||||
class Word < Data8
|
||||
def putstring
|
||||
X.putstring
|
||||
end
|
||||
end
|
||||
class Space
|
||||
def times(n)
|
||||
i = 0
|
@ -1,5 +0,0 @@
|
||||
class Space
|
||||
def main(arg)
|
||||
return 2 + 2
|
||||
end
|
||||
end
|
@ -1,11 +0,0 @@
|
||||
class Space
|
||||
def main(arg)
|
||||
a = 0
|
||||
b = 20
|
||||
while( a < b )
|
||||
a = a + 1
|
||||
b = b - 1
|
||||
end
|
||||
return a
|
||||
end
|
||||
end
|
@ -1,9 +0,0 @@
|
||||
class Space
|
||||
def main(arg)
|
||||
b = 10
|
||||
while( b >= 1 )
|
||||
b = b - 1
|
||||
end
|
||||
return b
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user