Skip to content

Commit

Permalink
add negate result type test
Browse files Browse the repository at this point in the history
  • Loading branch information
briangu committed Jan 8, 2024
1 parent 1e7cdeb commit 1e4da0a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_extra_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ class TestExtraCoreSuite(unittest.TestCase):
def assert_eval_cmp(self, a, b, klong=None):
self.assertTrue(eval_cmp(a, b, klong=klong))

def test_negate_array_result_type(self):
""" ensure the result type of negating an array is correct """
klong = KlongInterpreter()
r = klong("-1]")
self.assertTrue(is_integer(r))
r = klong("-1.0]")
self.assertTrue(is_float(r))
r = klong("-[1 2 3]")
self.assertTrue(r.dtype == int)
r = klong("-[1.0 2.0 3.0]")
self.assertTrue(r.dtype == float)

def test_match_empty_array_to_undefined_symbol(self):
""" symbol is undefined so does not match the empty array """
klong = KlongInterpreter()
Expand Down

0 comments on commit 1e4da0a

Please sign in to comment.