skip to content
==> tests/spec.c <==
1/* The spec of place.rs's tests: parts of each output region, in the view and in a show buffer. */
2#include "mesh/check.h"
3#include "mesh/place_spec.h"
4
5int main(void) {
6    mps_region st[] = {{0x0, 0x8}, {0x100, 0x4}}, out[] = {{0x1000, 0x40}, {0x1400, 0x40}};
7    mps_spec s = mps_new(2, st, 2, 0x4, out, 2, 0x2000, 4);
8    CHECK_U(mps_state_bytes(&s), 12);
9    CHECK_U(mps_out_bytes(&s), 0x80);
10    CHECK_U(mps_part_bytes(&s), 0x20);
11    mps_region p[2];
12    mps_part(&s, 3, p);
13    CHECK(p[0].off == 0x1030 && p[0].len == 0x10 && p[1].off == 0x1430 && p[1].len == 0x10);
14    mps_part_in_buffer(&s, 3, p);
15    CHECK(p[0].off == 0x30 && p[1].off == 0x70 && p[1].len == 0x10);
16    mps_spec c = mps_clone(&s);
17    CHECK(c.nout == 2 && c.out[1].off == 0x1400 && c.fanout == 4);
18    mps_free(&c);
19    mps_free(&s);
20    return mesh_check_done();
21}