2017-11-06 03:05:47 +00:00
|
|
|
#include "unit.h"
|
|
|
|
#include <dst/dst.h>
|
|
|
|
|
2017-11-27 00:31:40 +00:00
|
|
|
|
2017-11-06 03:05:47 +00:00
|
|
|
int main() {
|
|
|
|
int64_t i;
|
2017-11-06 14:44:10 +00:00
|
|
|
dst_init();
|
2017-11-06 03:05:47 +00:00
|
|
|
DstArray *array = dst_array(10);
|
|
|
|
assert(array->capacity == 10);
|
|
|
|
assert(array->count == 0);
|
|
|
|
for (i = 0; i < 500; ++i)
|
|
|
|
dst_array_push(array, dst_wrap_integer(i));
|
|
|
|
for (i = 0; i < 500; ++i)
|
|
|
|
assert(array->data[i].type == DST_INTEGER && array->data[i].as.integer == i);
|
|
|
|
for (i = 0; i < 200; ++i)
|
|
|
|
dst_array_pop(array);
|
|
|
|
assert(array->count == 300);
|
|
|
|
return 0;
|
|
|
|
}
|