Convert cpp20_spaceship_operator php test to python

This commit is contained in:
William S Fulton 2022-07-30 18:58:43 +01:00
commit eb8346b958

View 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)