valeri/test/array.cpp

26 lines
439 B
C++

#include "common.hpp"
#include "die.hpp"
#include "reader.hpp"
#include "test.hpp"
#include "writer.hpp"
StaticArena<64 * 1024 * 1024> arena;
TEST_CASE(array_append) {
auto a = DIEX(Array::create());
a = DIEX(a.append(1));
a = DIEX(a.append(2));
a = DIEX(a.append(3));
DIEX(arena_gc());
auto s = DIEX(write_one(a));
DIEX(arena_gc());
ASSERT_EQUALS(s, "[1 2 3]");
auto v = DIEX(a.get(1));
ASSERT_EQUALS(v, 2);
}