swig/Examples/test-suite/python/cpp20_spaceship_operator_runme.py
2022-07-31 00:58:35 +01:00

19 lines
391 B
Python

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)