Convert cpp20_spaceship_operator php test to python
This commit is contained in:
parent
4a8447d503
commit
eb8346b958
1 changed files with 19 additions and 0 deletions
19
Examples/test-suite/python/cpp20_spaceship_operator_runme.py
Normal file
19
Examples/test-suite/python/cpp20_spaceship_operator_runme.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
from cpp20_spaceship_operator import *
|
||||
|
||||
def check_equal(a, b):
|
||||
if a != b:
|
||||
raise RuntimeError("{} is not equal to {}".format(a, b))
|
||||
|
||||
# check_equal(ALIEN, true)
|
||||
check_equal(SPACE, 1)
|
||||
check_equal(COMET, 1)
|
||||
check_equal(cvar.v, 42)
|
||||
|
||||
x = A(1)
|
||||
y = A(2)
|
||||
|
||||
check_equal(spaceship(x, y) < 0, True)
|
||||
check_equal(spaceship(x, x), 0)
|
||||
check_equal(spaceship(y, x) > 0, True)
|
||||
|
||||
check_equal(f(), 42)
|
||||
Loading…
Add table
Add a link
Reference in a new issue