# see also: 053-division.cobra namespace Test class Test def main is shared assert 1 assert 2+2==4 assert 4-2==2 # unary minus assert -1 assert -1==-1 assert -1==0-1 assert 2+-1==1 # unary plus assert +1 assert 2+ +1==3 # multiply assert 2*4==8 assert 2*-4==-8 # modulus assert 5 % 4 == 1 assert 5 % 5 == 0 x = 1_000_000 # underscores are ignored by Cobra, but useful to people for separating thousands assert x==1000000 assert 2*3 + 4 assert (2*3 + 4) == 10 assert 2*3 + 4*5 == 26 assert (2*3 + 4*5) == 26 .testAugmentedAssignment def testAugmentedAssignment is shared x as int = 0 assert x==0 x += 1 assert x==1 x += 1 x *= 2 assert x==4 x -= 1 assert x==3 x //= 5 assert x == 0