import unittest
import hpat

class TestString(unittest.TestCase):
    def test_pass_return(self):
        def test_impl(_str):
            return _str
        hpat_func = hpat.jit(test_impl)
        # pass single string and return
        arg = 'test_str'
        self.assertEqual(hpat_func(arg), test_impl(arg))
        # pass string list and return
        arg = ['test_str1', 'test_str2']
        self.assertEqual(hpat_func(arg), test_impl(arg))

    def test_const(self):
        def test_impl():
            return 'test_str'
        hpat_func = hpat.jit(test_impl)
        self.assertEqual(hpat_func(), test_impl())

    def test_equality(self):
        def test_impl(_str):
            return (_str=='test_str')
        hpat_func = hpat.jit(test_impl)
        arg = 'test_str'
        self.assertEqual(hpat_func(arg), test_impl(arg))
        def test_impl(_str):
            return (_str!='test_str')
        hpat_func = hpat.jit(test_impl)
        self.assertEqual(hpat_func(arg), test_impl(arg))

    def test_concat(self):
        def test_impl(_str):
            return (_str+'test_str')
        hpat_func = hpat.jit(test_impl)
        arg = 'a_'
        self.assertEqual(hpat_func(arg), test_impl(arg))

    def test_split(self):
        def test_impl(_str):
            return _str.split('/')
        hpat_func = hpat.jit(test_impl)
        arg = 'aa/bb/cc'
        self.assertEqual(hpat_func(arg), test_impl(arg))

    def test_getitem_int(self):
        def test_impl(_str):
            return _str[3]
        hpat_func = hpat.jit(test_impl)
        arg = 'aa/bb/cc'
        self.assertEqual(hpat_func(arg), test_impl(arg))

    def test_string_int_cast(self):
        def test_impl(_str):
            return int(_str)
        hpat_func = hpat.jit(test_impl)
        arg = '12'
        self.assertEqual(hpat_func(arg), test_impl(arg))

    def test_string_float_cast(self):
        def test_impl(_str):
            return float(_str)
        hpat_func = hpat.jit(test_impl)
        arg = '12.2'
        self.assertEqual(hpat_func(arg), test_impl(arg))

if __name__ == "__main__":
    unittest.main()

@@ -20,16 +20,57 @@
 ort hpat
+%0Afrom hpat.str_arr_ext import StringArray
 %0A%0Aclass 
@@ -2102,16 +2102,574 @@
 (arg))%0A%0A
+    # string array tests%0A    def test_string_array_constructor(self):%0A        # create StringArray and return as list of strings%0A        def test_impl():%0A            return StringArray(%5B'ABC', 'BB', 'CDEF'%5D)%0A        hpat_func = hpat.jit(test_impl)%0A        self.assertEqual(hpat_func(), %5B'ABC', 'BB', 'CDEF'%5D)%0A%0A    def test_string_array_comp(self):%0A        def test_impl():%0A            A = StringArray(%5B'ABC', 'BB', 'CDEF'%5D)%0A            B = A=='ABC'%0A            return B.sum()%0A        hpat_func = hpat.jit(test_impl)%0A        self.assertEqual(hpat_func(), 1)%0A%0A
 if __nam

test string array