'Test issue https://github.com/numba/numba/issues/2188 where freezing
a constant array into the code thats prohibitively long and consume
too much RAM.'

def test_too_big_to_freeze(self):

    def test(biggie):
        expect = np.copy(biggie)
        self.assertEqual(typeof(biggie), typeof(expect))
        def pyfunc():
            return biggie
        cres = compile_isolated(pyfunc, ())
        self.assertLess(len(cres.library.get_llvm_str()), biggie.nbytes)
        out = cres.entry_point()
        self.assertIs(biggie, out)
        del out
        biggie = None
        out = cres.entry_point()
        np.testing.assert_equal(expect, out)
        self.assertEqual(typeof(expect), typeof(out))
    nelem = (10 ** 7)
    c_array = np.arange(nelem).reshape(nelem)
    f_array = np.asfortranarray(np.random.random((2, (nelem // 2))))
    self.assertEqual(typeof(c_array).layout, 'C')
    self.assertEqual(typeof(f_array).layout, 'F')
    test(c_array)
    test(f_array)
