2024-08-03 23:33:17 +00:00
|
|
|
#include "common.hpp"
|
|
|
|
#include "die.hpp"
|
|
|
|
#include "reader.hpp"
|
|
|
|
#include "test.hpp"
|
|
|
|
#include "writer.hpp"
|
|
|
|
|
|
|
|
StaticArena<64 * 1024 * 1024> arena;
|
|
|
|
|
|
|
|
TEST_CASE(array_append) {
|
2024-08-09 22:45:06 +00:00
|
|
|
auto a = DIEX(Array::create());
|
2024-08-03 23:33:17 +00:00
|
|
|
|
2024-08-09 22:45:06 +00:00
|
|
|
a = DIEX(a.append(1));
|
|
|
|
a = DIEX(a.append(2));
|
|
|
|
a = DIEX(a.append(3));
|
2024-08-03 23:33:17 +00:00
|
|
|
|
2024-08-09 22:45:06 +00:00
|
|
|
DIEX(arena_gc());
|
2024-08-03 23:33:17 +00:00
|
|
|
|
2024-08-09 22:45:06 +00:00
|
|
|
auto s = DIEX(write_one(a));
|
2024-08-03 23:33:17 +00:00
|
|
|
|
2024-08-09 22:45:06 +00:00
|
|
|
DIEX(arena_gc());
|
2024-08-03 23:33:17 +00:00
|
|
|
|
|
|
|
ASSERT_EQUALS(s, "[1 2 3]");
|
|
|
|
|
2024-08-09 22:45:06 +00:00
|
|
|
auto v = DIEX(a.get(1));
|
2024-08-03 23:33:17 +00:00
|
|
|
ASSERT_EQUALS(v, 2);
|
|
|
|
}
|