Permalink
Browse files

Remove boostrap tests taken from pynie.

  • Loading branch information...
1 parent 899356f commit a190dc8aaedeffa3a255f29acc841a7f909f6051 @lucian1900 committed Aug 16, 2011
No changes.
@@ -1,139 +0,0 @@
-#!./parrot pynie.pbc
-# -*- coding: utf-8 -*-
-
-# turn on debug so assert works
-__debug__ = 1 # XXX not valid in real Python.
-
-#len
-print('test: len')
-n = len([1,2,3,4])
-if n == 4: print('success: len')
-else: print('failure: len')
-
-#list
-print('test: list')
-lst1 = [ 1,2,3,4 ]
-lst2 = list(lst1)
-lst1.pop()
-lst1.pop()
-lst1.pop()
-lst1.pop()
-if lst2[2] == 3: print('success: list')
-else: print('failure: list')
-
-#range
-print('test: range')
-lst = list(range(4))
-ok = 0
-n = -1
-for i in lst:
- n += 1
- if n == i: ok += 1
-if ok == 4: print('success: range')
-else: print('failure: range')
-
-#str
-print('test: str')
-if str(5) == '5': print('success: str')
-else: print('failure: str')
-
-print('test: len/str')
-if len(str(861)) == 3: print('success: len/str')
-else: print('failure: len/str')
-
-#max
-print('test: max (simple)')
-if max(range(5)) == 4: print('success: max (simple)')
-else: print('failure: max (simple)')
-
-print('test: max (mixed)')
-if max([1,98,3,8,32,8]) == 98: print('success: max (mixed)')
-else: print('failure: max (mixed)')
-
-#min
-print('test: min (simple)')
-if min(range(5)) == 0: print('success: min (simple)')
-else: print('failure: min (simple)')
-
-print('test: min (mixed)')
-if min([98,1,3,8,32,8]) == 1: print('success: min (mixed)')
-else: print('failure: min (mixed)')
-
-#ord
-print('test: ord')
-if ord('a') == 97: print('success: ord')
-else: print('failure: ord')
-
-#pow
-print('test: pow (2 args)')
-if pow(2,3) == 8: print('success: pow (2 args)')
-else: print('failure: pow (2 args)')
-
-print('test: pow (3 args)')
-if pow(2,3,3) == 2: print('success: pow (3 args)')
-else: print('failure: pow (3 args)')
-
-#sum
-print('test: sum')
-if sum(range(5)) == 10: print('success: sum')
-else: print('failure: sum')
-
-#repr
-print('test: repr (int)')
-if repr(5) == '5': print('success: repr (int)')
-else: print('failure: repr (int)')
-
-print('test: repr (string)')
-if repr('hi') == "'hi'": print('success: repr (string)')
-else: print('failure: repr (string)')
-
-print('test: repr (list)')
-a = [ 1, 2, 'hi' ]
-repr_a = "[1, 2, 'hi']"
-if repr(a) == repr_a: print('success: repr (list)')
-else: print('failure: repr (list)')
-
-#map
-print('test: map (builtin func)')
-a = [ 1, 2, 3, 4 ]
-b = [ '1', '2', '3', '4' ]
-res = map(str, a)
-ok = 1
-for i in range(4):
- if res[i] != b[i]: ok = 0
-if ok: print('success: map (builtin func)')
-else: print('failure: map (builtin func)')
-
-print('test: map (python func)')
-try:
- a = [ 1, 2, 3, 4 ]
- b = [ 2, 3, 4, 5 ]
- def f(x): return x + 1
- res = map(f, a)
- for i in range(4):
- assert res[i] == b[i]
- print('success: map (python func)')
-except:
- print('failure: map (python func)')
-
-#hex
-print('test: hex')
-try:
- a = [ 0, 5, -256, 1000 ]
- b = [ '0x0', '0x5', '-0x100', '0x3e8' ]
- res = map(hex, a)
- for i in range(4):
- assert res[i] == b[i]
- print('success: hex')
-except:
- print('failure: hex')
-
-#type
-print('test: type')
-try:
- assert type('foo') is type('yum')
- assert type('foo') is not type(5)
- assert type(8) is type(5)
- print('success: type')
-except:
- print('failure: type')
@@ -1,84 +0,0 @@
-#!./parrot
-
-print('test: len')
-a = [1,2,3]
-if len(a) == 3: print('success: len')
-else: print('failure: len')
-
-print('test: equality')
-a = [0, 1, 2]
-if a == [0, 1, 2] and a != [7, 8, 9]: print('success: equality')
-else: print('failure: equality')
-
-print('test: append')
-a = []
-for i in range(3): a.append(i)
-if a == [0, 1, 2]: print('success: append')
-else: print('failure: append')
-
-print('test: count')
-a = [1,2,5,6,5,5,5,5,6]
-if a.count(5) == 5 and a.count(6) == 2: print('success: count')
-else: print('failure: count')
-
-print('test: extend')
-a = [0, 1, 2]
-b = [7, 8, 9]
-a.extend(b)
-# b should be added to a, but should not be affected
-if a == [0, 1, 2, 7, 8, 9] and b == [7, 8, 9]: print('success: extend')
-else: print('failure: extend')
-
-print('test: index')
-a = [5,8,7]
-# XXX check for ValueError if value doesn't exist
-if a.index(8) == 1: print('success: index')
-else: print('failure: index')
-
-print('test: insert')
-a = [0, 1, 2]
-a.insert(1, 8)
-if a == [0, 8, 1, 2]: print('success: insert')
-else: print('failure: insert')
-
-print('test: pop')
-a = [0, 1, 2]
-i = a.pop() # pop the 2
-j = a.pop(0) # pop the 0
-if i == 2 and j == 0: print('success: pop')
-else: print('failure: pop')
-
-print('test: remove')
-a = [5,8,7]
-# XXX check for ValueError if value doesn't exist
-a.remove(8)
-if a == [5, 7]: print('success: remove')
-else: print('failure: remove')
-
-print('test: reverse (empty)')
-a = []
-a.reverse()
-if a == []: print('success: reverse (empty)')
-else: print('failure: reverse (empty)')
-
-print('test: reverse (even element count)')
-a = [1, 2, 3, 4, 5, 6]
-a.reverse()
-if a == [6,5,4,3,2,1]: print('success: reverse (even element count)')
-else: print('failure: reverse (even element count)')
-
-print('test: reverse (odd element count)')
-a = [1, 2, 3, 4, 5]
-a.reverse()
-if a == [5,4,3,2,1]: print('success: reverse (odd element count)')
-else: print('failure: reverse (odd element count)')
-
-print('test: str(list)')
-a = [0, 1, 2]
-if str(a) == '[0, 1, 2]': print('success: str(list)')
-else: print('failure: str(list)')
-
-print('test: repr(list)')
-a = [0, 1, 2]
-if repr(a) == '[0, 1, 2]': print('success: repr(list)')
-else: print('failure: repr(list)')
@@ -1,13 +0,0 @@
-#!./parrot
-
-print('test: str.split')
-if 'foobar'.split('o') == [ 'f', '', 'bar' ]:
- print('success: str.split')
-else:
- print('failure: str.split')
-
-print('test: str.join')
-if '---'.join(['hello', 'world']) == 'hello---world':
- print('success: str.join')
-else:
- print('failure: str.join')
@@ -1,105 +0,0 @@
-#!./parrot pynie.pbc
-
-# if
-
-print('test: if true')
-if 1: print('success: if true')
-else: print('failure: if true')
-
-print('test: if false')
-if 0: print('failure: if false')
-else: print('success: if false')
-
-print('test: elif true')
-if 0: print('failure: elif true')
-elif 1: print('success: elif true')
-
-print('test: elif false')
-if 0: print('failure: elif false')
-elif 0: print('failure: elif false')
-else: print('success: elif false')
-
-# while
-
-i=5
-while i < 7:
- print('test:', i)
- print('success:', i)
- i=i+1
-
-print('test: while count')
-if i == 7: print('success: while count')
-else: print('failure: while count')
-
-print('test: while false')
-while 0:
- print('failure: while false')
-else:
- print('success: while false')
-
-# for
-
-print('test: for list literal')
-n = 0
-compare = 1
-for i in [ 1,2,3,4 ]:
- n += 1
- if i != n: compare = 0
-if compare: print('success: for list literal')
-else: print('failure: for list literal')
-
-print('test: for list assign')
-lst = [ 1,2,3,4 ]
-n = 0
-compare = 1
-for i in lst:
- n += 1
- if i != n: compare = 0
-if compare: print('success: for list assign')
-else: print('failure: for list assign')
-
-print('test: for list bare')
-n = 0
-compare = 1
-for i in 1,2,3,4:
- n += 1
- if i != n: compare = 0
-if compare: print('success: for list bare')
-else: print('failure: for list bare')
-
-print('test: nested fors')
-lst = [ ]
-for i in range(3):
- for j in range(3):
- lst.append((i + 1) * (j + 1))
-compare = 1
-lst2 = [ 1, 2, 3, 2, 4, 6, 3, 6, 9 ]
-for i in range(9):
- if lst[i] != lst2[i]: compare = 0
-if compare: print('success: nested fors')
-else: print('failure: nested fors')
-
-print('test: multiple iterators')
-#compare = 0
-#for i, j in ( (0, 0), (1, 2), (2, 4) ):
-# if j == i * 2: compare += 1
-#if compare == 3: print 'success: multiple iterators'
-#else: print 'failure: multiple iterators'
-print('xfail: multiple iterators [')
-print('multiple iterators not implemented yet')
-print(']')
-
-print('test: nested scopes')
-i = 4
-if 0:
- if 0: pass
- i = 2
-if i == 2: print('failure: nested scopes')
-else: print('success: nested scopes')
-
-print('test: for var exists after loop')
-i = 0
-for i in [7,1,3]:
- pass
-if i == 3: print('success: for var exists after loop')
-else: print('failure: for var exists after loop')
@@ -1,40 +0,0 @@
-#!./parrot
-
-print('test: one element dict')
-a = {"foo":1}
-if a: print('success: one element dict')
-else: print('failure: one element dict')
-
-print('test: display dict element')
-b = a['foo']
-if b == 1: print('success: display dict element')
-else: print('failure: display dict element')
-
-print("test: display dict {'foo': 1}")
-print("success: display dict", a)
-
-print('test: add element to dict')
-a['bar'] = "baz"
-b = a['bar']
-if b == 'baz': print('success: add element to dict')
-else: print('failure: add element to dict')
-
-print('test: delete element from dict')
-del a['bar']
-if len(a) > 1: print('failure: delete element from dict')
-else: print('success: delete element from dict')
-
-#print('test: delete element from dict, in')
-#if 'bar' in a: print('failure: delete element from dict, in')
-#else: print('success: delete element from dict, in')
-
-print("test: integer as index")
-a = {1: 2}
-b = list(a.keys())
-if b[0] == 1: print('success: integer as index')
-else: print('failure: integer as index')
-
-print('test: multiple elements')
-a = {1: 2, 3: 4, 5: 6}
-if len(a) == 3: print('success: multiple elements')
-else: print('failure: multiple elements')
Oops, something went wrong.

0 comments on commit a190dc8

Please sign in to comment.