michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "js/HashTable.h" michael@0: #include "jsapi-tests/tests.h" michael@0: michael@0: typedef js::HashSet, js::SystemAllocPolicy> IntSet; michael@0: michael@0: static const uint32_t MaxAllowedHashInit = 1 << 23; michael@0: michael@0: BEGIN_TEST(testHashInitAlmostTooHuge) michael@0: { michael@0: IntSet smallEnough; michael@0: CHECK(smallEnough.init(MaxAllowedHashInit)); michael@0: return true; michael@0: } michael@0: END_TEST(testHashInitAlmostTooHuge) michael@0: michael@0: BEGIN_TEST(testHashInitTooHuge) michael@0: { michael@0: IntSet tooBig; michael@0: CHECK(!tooBig.init(MaxAllowedHashInit + 1)); michael@0: return true; michael@0: } michael@0: END_TEST(testHashInitTooHuge)