Order resource data from instructions by resource class. This simplifies
[jitcs.git] / tests / test_adt_tmpvector.cpp
blobedc985c743951207ddb8d9e709344000cff2ed36
1 #include "jitcs_int_adt_tmpvector.h"
2 #include "jitcs_tmpalloc.h"
3 #include "unittest.h"
5 #include <stdio.h>
6 using namespace jitcs;
8 static void test(UnitTest& t) {
9 TempAllocator alloc;
10 TmpVector<size_t,2> tmp(alloc);
11 t.check("empty", tmp.size() == 0 && tmp.isLocalData());
12 tmp.push_back(0x12345678);
13 t.check("push_back/1", tmp.size() == 1 && tmp.isLocalData() && tmp[0] == 0x12345678);
14 tmp.push_back(0xdeadbeef);
15 t.check("push_back/2", tmp.size() == 2 && tmp.isLocalData() && tmp[1] == 0xdeadbeef);
16 tmp.push_back(0x1);
17 t.check("push_back/3", tmp.size() == 3 && !tmp.isLocalData() && tmp[1] == 0xdeadbeef && tmp[2] == 1);
20 static UnitTestRun _("ADT/TmpVector", test);