int main(int ac, char **av) { int lc; int pid; tst_parse_opts(ac, av, NULL, NULL); for (lc = 0; lc < TEST_LOOPING(lc); ++lc) { setup(); pid = tst_fork(); fd2 = setup_read(); if (!pid) { send_information(); } else { if (check_information()) tst_resm(TFAIL, "Data received in eventX"); else tst_resm(TPASS, "No data received in eventX"); } } tst_exit(); }
static void test_vec_array() { array_t *pos, *rpos; pos = CEX_make_vec_array(0); add_vec(pos, 0,0,0); add_vec(pos, 5,0,M_PI); add_vec(pos, 23e12,-5e-13,34.23); rpos = CEX_reversed_array(pos); CEX_extend_array(pos, rpos); CEX_extend_array(pos, pos); CEX_free_array(rpos); msg_t *msg = CEX_make_write_msg(0); CEX_msg_write_vec_array(msg, pos); setup_read(msg); array_t *pos2 = CEX_msg_read_vec_array(msg); REQ_MSG_EOFP(msg); CEX_free_msg(msg); REQ_VARR(pos2); assert(ARR_LENGTH(pos) == ARR_LENGTH(pos2)); for (int i=0; i <ARR_LENGTH(pos); i++) { vec_t v1 = ARR_INDEX_AS(vec_t, pos, i); vec_t v2 = ARR_INDEX_AS(vec_t, pos2, i); #if 0 xprintf("%d " Vec3_FRMT("%.5e") " " Vec3_FRMT("%.5e"), i, Vec3_ARGS(v1), Vec3_ARGS(v2)); #endif EXPECT_DOUBLE(1e-10, v1.x, v2.x); EXPECT_DOUBLE(1e-10, v2.y, v2.y); EXPECT_DOUBLE(1e-10, v1.z, v2.z); } CEX_free_array(pos); CEX_free_array(pos2); }