🐐 NVLLVUS fix
This commit is contained in:
17
tests.py
17
tests.py
@@ -881,7 +881,7 @@ class TestNumerals(unittest.TestCase):
|
||||
|
||||
# int_to_num: valid cases
|
||||
def test_int_to_num(self):
|
||||
for n, s in [(1,"I"),(4,"IV"),(9,"IX"),(40,"XL"),(42,"XLII"),(3999,"MMMCMXCIX")]:
|
||||
for n, s in [(0,"NVLLVS"),(1,"I"),(4,"IV"),(9,"IX"),(40,"XL"),(42,"XLII"),(3999,"MMMCMXCIX")]:
|
||||
self.assertEqual(int_to_num(n, False), s)
|
||||
|
||||
def test_int_to_num_above_3999_raises(self):
|
||||
@@ -907,6 +907,9 @@ class TestMakeString(unittest.TestCase):
|
||||
def test_int(self):
|
||||
self.assertEqual(make_string(ValInt(3)), "III")
|
||||
|
||||
def test_int_zero(self):
|
||||
self.assertEqual(make_string(ValInt(0)), "NVLLVS")
|
||||
|
||||
def test_bool_true(self):
|
||||
self.assertEqual(make_string(ValBool(True)), "VERITAS")
|
||||
|
||||
@@ -939,6 +942,8 @@ dic_type_tests = [
|
||||
('DIC("")', Program([], [ExpressionStatement(BuiltIn("DIC", [String("")]))]), ValStr(""), "\n"),
|
||||
# arithmetic result printed as numeral
|
||||
("DIC(II + III)", Program([], [ExpressionStatement(BuiltIn("DIC", [BinOp(Numeral("II"), Numeral("III"), "SYMBOL_PLUS")]))]), ValStr("V"), "V\n"),
|
||||
# integer 0 prints as NVLLVS
|
||||
("DIC(I - I)", Program([], [ExpressionStatement(BuiltIn("DIC", [BinOp(Numeral("I"), Numeral("I"), "SYMBOL_MINUS")]))]), ValStr("NVLLVS"), "NVLLVS\n"),
|
||||
# multiple args of mixed types
|
||||
('DIC("x", VERITAS)', Program([], [ExpressionStatement(BuiltIn("DIC", [String("x"), Bool(True)]))]), ValStr("x VERITAS"), "x VERITAS\n"),
|
||||
]
|
||||
@@ -1062,6 +1067,8 @@ interpolation_tests = [
|
||||
Program([], [
|
||||
ExpressionStatement(InterpolatedString([String("value: "), Nullus()]))
|
||||
]), ValStr("value: NVLLVS")),
|
||||
# integer 0 interpolates as NVLLVS
|
||||
('"value: {I - I}"', Program([], [ExpressionStatement(InterpolatedString([String("value: "), BinOp(Numeral("I"), Numeral("I"), "SYMBOL_MINUS")]))]), ValStr("value: NVLLVS")),
|
||||
# expression-only string (no literal parts around it)
|
||||
('DESIGNA x VT "hi"\n"{x}"',
|
||||
Program([], [
|
||||
@@ -1194,6 +1201,14 @@ comparison_tests = [
|
||||
("NVLLVS DISPAR NVLLVS", Program([], [ExpressionStatement(BinOp(Nullus(), Nullus(), "KEYWORD_DISPAR"))]), ValBool(False)),
|
||||
# cross-type: an int and a string are never equal
|
||||
('I DISPAR "I"', Program([], [ExpressionStatement(BinOp(Numeral("I"), String("I"), "KEYWORD_DISPAR"))]), ValBool(True)),
|
||||
# integer 0 equals NVLLVS
|
||||
("(I - I) EST NVLLVS", Program([], [ExpressionStatement(BinOp(BinOp(Numeral("I"), Numeral("I"), "SYMBOL_MINUS"), Nullus(), "KEYWORD_EST"))]), ValBool(True)),
|
||||
("NVLLVS EST (I - I)", Program([], [ExpressionStatement(BinOp(Nullus(), BinOp(Numeral("I"), Numeral("I"), "SYMBOL_MINUS"), "KEYWORD_EST"))]), ValBool(True)),
|
||||
("(I - I) DISPAR NVLLVS", Program([], [ExpressionStatement(BinOp(BinOp(Numeral("I"), Numeral("I"), "SYMBOL_MINUS"), Nullus(), "KEYWORD_DISPAR"))]), ValBool(False)),
|
||||
("NVLLVS DISPAR (I - I)", Program([], [ExpressionStatement(BinOp(Nullus(), BinOp(Numeral("I"), Numeral("I"), "SYMBOL_MINUS"), "KEYWORD_DISPAR"))]), ValBool(False)),
|
||||
# non-zero integer does not equal NVLLVS
|
||||
("I EST NVLLVS", Program([], [ExpressionStatement(BinOp(Numeral("I"), Nullus(), "KEYWORD_EST"))]), ValBool(False)),
|
||||
("NVLLVS DISPAR I", Program([], [ExpressionStatement(BinOp(Nullus(), Numeral("I"), "KEYWORD_DISPAR"))]), ValBool(True)),
|
||||
]
|
||||
|
||||
class TestComparisons(unittest.TestCase):
|
||||
|
||||
Reference in New Issue
Block a user