Example #1
0
TEST_F(DonutSlotTest, SeekTest)
{
	Handler<Object> obj100 = heap->createInt(100);
	Slot slot;
	clock->tick();
	slot.store(heap, obj100.get());

	ASSERT_TRUE(slot.have());
	ASSERT_NO_THROW(slot.load());
	ASSERT_EQ(obj100->toInt(heap), slot.load()->toInt(heap));

	clock->tick();
	slot.onForwardNotify(heap);//FIXME: シークの通知はヒープにぶら下がったオブジェクトのスロットにしか、来ない
	Handler<Object> obj200 = heap->createInt(200);
	slot.store(heap, obj200.get());

	ASSERT_TRUE(slot.have());
	ASSERT_NO_THROW(slot.load());
	ASSERT_EQ(obj200->toInt(heap), slot.load()->toInt(heap));

	clock->seek(clock->now()-1);
	slot.onBackNotify(heap);//FIXME: シークの通知はヒープにぶら下がったオブジェクトのスロットにしか、来ない

	ASSERT_TRUE(slot.have());
	ASSERT_NO_THROW(slot.load());
	ASSERT_EQ(obj100->toInt(heap), slot.load()->toInt(heap));

	clock->seek(clock->firstTime());
	slot.onBackNotify(heap);//FIXME: シークの通知はヒープにぶら下がったオブジェクトのスロットにしか、来ない
	ASSERT_FALSE(slot.have());
	ASSERT_ANY_THROW(slot.load());
}
Example #2
0
TEST_F(DonutSlotTest, RegTest)
{
	Handler<Heap> heap = donut->heap();
	Handler<Object> obj100 = heap->createInt(100);
	Slot slot;
	slot.store(heap, obj100.get());

	ASSERT_TRUE(slot.have());
	ASSERT_NO_THROW(slot.load());
	ASSERT_EQ(obj100->toInt(heap), slot.load()->toInt(heap));

	Handler<Object> obj200 = heap->createInt(200);
	slot.store(heap, obj200.get());

	ASSERT_TRUE(slot.have());
	ASSERT_NO_THROW(slot.load());
	ASSERT_EQ(obj200->toInt(heap), slot.load()->toInt(heap));
}
Example #3
0
TEST_F(DonutSlotTest, NopTest)
{
	Slot slot;
	ASSERT_FALSE(slot.have());
	ASSERT_ANY_THROW(slot.load());
}