void test_keys() { tbl->store(state, Fixnum::from(0), Fixnum::from(1)); tbl->store(state, Fixnum::from(2), Fixnum::from(3)); Array* ary = tbl->keys(state); TS_ASSERT_EQUALS(ary->size(), 2); TS_ASSERT_EQUALS(ary->get(state, 0), Fixnum::from(0)); TS_ASSERT_EQUALS(ary->get(state, 1), Fixnum::from(2)); }
void CompactLookupTable::Info::show(STATE, Object* self, int level) { CompactLookupTable* tbl = as<CompactLookupTable>(self); Array* keys = tbl->keys(state); size_t size = keys->size(); if(size == 0) { class_info(state, self, true); return; } class_info(state, self); std::cout << ": " << size << std::endl; indent(++level); for(size_t i = 0; i < size; i++) { std::cout << ":" << as<Symbol>(keys->get(state, i))->c_str(state); if(i < size - 1) std::cout << ", "; } std::cout << std::endl; close_body(level); }