Exemplo n.º 1
0
void
alarm3_handler(intptr_t exinf)
{
	ER_UINT	ercd;

	switch (++alarm3_count) {
	case 1:
		check_point(21);
		check_assert(fch_hrt() == 441U);

		check_point(22);
		ercd = wup_tsk(TASK1);
		check_ercd(ercd, E_OK);

		return;

		check_point(0);

	case 2:
		check_point(44);
		check_assert(fch_hrt() == 840U);

		check_point(45);
		ercd = wup_tsk(TASK1);
		check_ercd(ercd, E_OK);

		return;

		check_point(0);

	default:
		check_point(0);
	}
	check_point(0);
}
Exemplo n.º 2
0
void
task4(intptr_t exinf)
{
	ER_UINT	ercd;
	T_RTSK	rtsk;
	T_RMTX	rmtx;

	check_point(19);
	ercd = loc_mtx(MTX1);
	check_ercd(ercd, E_OK);

	check_point(22);
	ercd = ref_tsk(TASK3, &rtsk);
	check_ercd(ercd, E_OK);

	check_assert(rtsk.tskstat == TTS_DMT);

	ercd = ref_mtx(MTX1, &rmtx);
	check_ercd(ercd, E_OK);

	check_assert(rmtx.htskid == TASK4);

	check_assert(rmtx.wtskid == TSK_NONE);

	check_point(23);
	ercd = slp_tsk();
	check_ercd(ercd, E_OK);

	check_point(0);
}
Exemplo n.º 3
0
void
task3(intptr_t exinf)
{
	ER		ercd;

	check_point(4);

	ercd = ena_tex();
	check_ercd(ercd, E_OK);

	/*
	 *  テスト項目(C)のテスト
	 */
	tex_start_count = 0U;
	ercd = ras_tex(TASK3, 0x0001);
	check_ercd(ercd, E_OK);
	check_assert(tex_start_count == UTASK_TEX_COUNT);

	check_point(5);

	/*
	 *  テスト項目(D)のテスト
	 */
	tex_start_count = 0U;
	ercd = ras_tex(TASK3, 0x0002);
	check_ercd(ercd, E_OK);
	check_assert(tex_start_count == UTASK_TEX_COUNT);

	check_finish(6);
}
Exemplo n.º 4
0
static void test_unstr_strpos(void)
{
	unstr_t *emp = unstr_init_memory(1);
	unstr_t *text = unstr_init_memory(1);
	unstr_t *search = unstr_init_memory(1);

	unstr_strcpy_char(text, "0123456789");
	unstr_strcpy_char(search, "34");

	check_assert(unstr_strpos(NULL, search) < 0);
	check_assert(unstr_strpos(emp, search) < 0);
	check_assert(unstr_strpos(text, NULL) < 0);
	check_assert(unstr_strpos(text, emp) < 0);

	unstr_strcpy_char(text, "0123456789");
	unstr_strcpy_char(search, "34");
	check_int(unstr_strpos(text, search), 3);

	unstr_strcpy_char(text, "000123456789");
	unstr_strcpy_char(search, "0");
	check_int(unstr_strpos(text, search), 0);

	unstr_strcpy_char(text, "0123456789");
	unstr_strcpy_char(search, "aaa");
	check_assert(unstr_strpos(text, search) < 0);

	unstr_delete(3, emp, text, search);
}
Exemplo n.º 5
0
static void test_unstr_strstr_char(void)
{
	char *ret = 0;
	char *ans1 = "4567890";
	char *ans2 = "7890";
	char *s1 = "45";
	char *s2 = "7890";
	char *s3 = "hoge";
	unstr_t *str = unstr_init("1234567890");
	unstr_t *emp = unstr_init_memory(1);
	check_null(unstr_strstr_char(NULL, s1));
	check_null(unstr_strstr_char(NULL, ""));
	check_null(unstr_strstr_char(str, NULL));
	check_null(unstr_strstr_char(emp, NULL));
	check_null(unstr_strstr_char(str, ""));
	check_null(unstr_strstr_char(emp, s1));
	check_null(unstr_strstr_char(str, s3));

	ret = unstr_strstr_char(str, s1);
	check_assert(ret != NULL);
	check_char(ret, ans1);

	ret = unstr_strstr_char(str, s2);
	check_assert(ret != NULL);
	check_char(ret, ans2);

	unstr_delete(2, str, emp);
}
Exemplo n.º 6
0
void
task1(intptr_t exinf)
{
	ER_UINT	ercd;

	test_start(__FILE__);

	check_point(1);
	ercd = act_tsk(TASK2);
	check_ercd(ercd, E_OK);

	ercd = act_tsk(TASK4);
	check_ercd(ercd, E_OK);

	ercd = slp_tsk();
	check_ercd(ercd, E_OK);

	check_point(4);
	ercd = snd_mbf(MBF1, string2, 25);
	check_ercd(ercd, E_OK);

	check_point(6);
	check_assert(strncmp(buf1, string2, 25) == 0);

	ercd = act_tsk(TASK3);
	check_ercd(ercd, E_OK);

	ercd = slp_tsk();
	check_ercd(ercd, E_OK);

	check_point(13);
	ercd = snd_mbf(MBF1, string2, 10);
	check_ercd(ercd, E_OK);

	ercd = rcv_mbf(MBF1, buf1);
	check_ercd(ercd, 10);

	check_assert(strncmp(buf1, string2, 10) == 0);

	ercd = slp_tsk();
	check_ercd(ercd, E_OK);

	check_point(24);
	ercd = chg_pri(TASK3, LOW_PRIORITY);
	check_ercd(ercd, E_OK);

	ercd = slp_tsk();
	check_ercd(ercd, E_OK);

	check_point(34);
	ercd = chg_pri(TASK2, HIGH_PRIORITY);
	check_ercd(ercd, E_OK);

	ercd = slp_tsk();
	check_ercd(ercd, E_OK);

	check_point(0);
}
Exemplo n.º 7
0
static void test_unstr_empty(void)
{
	unstr_t *str = unstr_init("unkokkokussakusa");
	check_assert(unstr_empty(NULL) == UNSTRING_TRUE);
	check_assert(unstr_empty(str) == UNSTRING_FALSE);
	unstr_zero(str);
	check_assert(unstr_empty(str) == UNSTRING_TRUE);
	unstr_free(str);
}
Exemplo n.º 8
0
void
task1(intptr_t exinf)
{
	ER_UINT	ercd;
	T_RTSK	rtsk;
	T_RMTX	rmtx;
	PRI		intpri;

	test_start(__FILE__);

	check_point(1);
	ercd = sta_alm(ALM1, TEST_TIME_CP);
	check_ercd(ercd, E_OK);

	ercd = slp_tsk();
	check_ercd(ercd, E_OK);

	check_point(3);
	ercd = act_tsk(TASK2);
	check_ercd(ercd, E_OK);

	check_point(5);
	ercd = ref_tsk(TASK2, &rtsk);
	check_ercd(ercd, E_OK);

	check_assert(rtsk.tskstat == TTS_DMT);

	ercd = ref_mtx(MTX1, &rmtx);
	check_ercd(ercd, E_OK);

	check_assert(rmtx.htskid == TSK_NONE);

	check_assert(rmtx.wtskid == TSK_NONE);

	ercd = act_tsk(TASK2);
	check_ercd(ercd, E_OK);

	check_point(16);
	ercd = get_ipm(&intpri);
	check_ercd(ercd, E_OK);

	check_assert(intpri == TIPM_ENAALL);

	ercd = act_tsk(TASK2);
	check_ercd(ercd, E_OK);

	check_point(23);
	check_assert(sns_dsp() == false);

	ercd = act_tsk(TASK2);
	check_ercd(ercd, E_OK);

	check_finish(28);
	check_point(0);
}
Exemplo n.º 9
0
void
task2(intptr_t exinf)
{
	ER_UINT	ercd;
	ID		somid;

	test_start(__FILE__);

	check_point(1);
	ercd = get_som(&somid);
	check_ercd(ercd, E_OK);

	check_assert(somid == SOM1);

	WAIT(task2_flag);

	check_point(4);
	ercd = chg_som(SOM2);
	check_ercd(ercd, E_OK);

	ercd = get_som(&somid);
	check_ercd(ercd, E_OK);

	check_assert(somid == SOM1);

	WAIT(task2_flag);

	check_point(8);
	WAIT(task2_flag);

	check_point(14);
	WAIT(task2_flag);

	check_point(19);
	ercd = sta_cyc(CYC1);
	check_ercd(ercd, E_OK);

	ercd = get_som(&somid);
	check_ercd(ercd, E_OK);

	check_assert(somid == SOM1);

	WAIT(task2_flag);

	check_point(25);
	WAIT(task2_flag);

	check_point(30);
	WAIT(task2_flag);

	check_point(0);
}
Exemplo n.º 10
0
void
cpuexc_handler(void *p_excinf)
{
	check_point(3);
	check_assert(xsns_xpn(p_excinf) == true);
	check_assert(xsns_dpn(p_excinf) == true);

#ifdef CANNOT_RETURN_CPUEXC
	check_finish(4);
#endif /* CANNOT_RETURN_CPUEXC */

	check_point(4);
}
Exemplo n.º 11
0
static void test_unstr_sscanf(void)
{
	size_t ret = 0;
	unstr_t *source1 = unstr_init("unko<>hoge<>fuga");
	unstr_t *source2 = unstr_init("<>unko<>hoge");
	unstr_t *source3 = unstr_init("unko<>hoge<>fuga<>");
	unstr_t *source4 = unstr_init("unko<><>fuga");
	unstr_t *source5 = unstr_init("unko$hoge$fuga");
	unstr_t *p1 = unstr_init_memory(1);
	unstr_t *p2 = unstr_init_memory(1);
	unstr_t *p3 = unstr_init_memory(1);

	ret = unstr_sscanf(NULL, "<>$<>", p1);
	check_int(ret, 0);
	ret = unstr_sscanf(source1, NULL, p1);
	check_int(ret, 0);
	ret = unstr_sscanf(source1, "unko<>", p1);
	check_int(ret, 0);

	ret = unstr_sscanf(source1, "$<>$<>$<>", p1, p2, p3);
	check_int(ret, 3);
	check_unstr_char(p1, "unko");
	check_unstr_char(p2, "hoge");
	check_unstr_char(p3, "fuga");

	ret = unstr_sscanf(source2, "$<>$<><>$", p1, p2, p3);
	check_int(ret, 2);
	check_assert(unstr_empty(p1) == UNSTRING_TRUE);
	check_unstr_char(p2, "unko<>hoge");

	ret = unstr_sscanf(source3, "$<>$<>$", p1, p2, p3);
	check_int(ret, 3);
	check_unstr_char(p1, "unko");
	check_unstr_char(p2, "hoge");
	check_unstr_char(p3, "fuga<>");

	ret = unstr_sscanf(source4, "$<>$<>$", p1, p2, p3);
	check_int(ret, 3);
	check_unstr_char(p1, "unko");
	check_assert(unstr_empty(p2) == UNSTRING_TRUE);
	check_unstr_char(p3, "fuga");

	ret = unstr_sscanf(source5, "$$$$$$", p1, p2, p3);
	check_int(ret, 3);
	check_unstr_char(p1, "unko");
	check_unstr_char(p2, "hoge");
	check_unstr_char(p3, "fuga");

	unstr_delete(8, source1, source2, source3, source4, source5, p1, p2, p3);
}
Exemplo n.º 12
0
static void test_unstr_explode(void)
{
	size_t i = 0;
	size_t len = 0;
	unstr_t *str = unstr_init("1 2 3 4 5 6 7 8 9 0 ");
	char *delim = " ";
	char *ans[11] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", ""};
	unstr_t *emp = unstr_init_memory(1);
	unstr_t **ret = 0;
	check_null(unstr_explode(NULL, delim, &len));
	check_null(unstr_explode(emp, delim, &len));
	check_null(unstr_explode(str, NULL, &len));
	check_null(unstr_explode(str, "", &len));
	check_null(unstr_explode(str, delim, NULL));

	len = 1234;
	ret = unstr_explode(str, delim, &len);
	check_assert(len < 1234);
	for(i = 0; i < len; i++){
		check_unstr_char(ret[i], ans[i]);
		unstr_free(ret[i]);
	}
	unstr_delete(2, str, emp);
	free(ret);
}
Exemplo n.º 13
0
void
cpuexc_handler(void *p_excinf)
{
	ER		ercd;

	check_point(3);
	check_state_i(true, false, true, true, false);
	check_assert(xsns_xpn(p_excinf) == false);
	check_assert(xsns_dpn(p_excinf) == true);

	check_point(4);
	ercd = iras_tex(TASK1, 1U);
	check_ercd(ercd, E_OK);
	ercd = iloc_cpu();
	check_ercd(ercd, E_OK);
}
Exemplo n.º 14
0
void
task1(intptr_t exinf)
{
	ER_UINT	ercd;
	ID		somid;

	check_point(2);
	WAIT(task1_flag);

	check_point(5);
	WAIT(task1_flag);

	check_point(7);
	ercd = get_som(&somid);
	check_ercd(ercd, E_OK);

	check_assert(somid == SOM2);

	WAIT(task1_flag);

	check_point(10);
	ercd = get_som(&somid);
	check_ercd(ercd, E_OK);

	check_assert(somid == SOM3);

	WAIT(task1_flag);

	check_point(13);
	ercd = get_som(&somid);
	check_ercd(ercd, E_OK);

	check_assert(somid == SOM2);

	WAIT(task1_flag);

	check_point(20);
	WAIT(task1_flag);

	check_point(26);
	WAIT(task1_flag);

	check_point(31);
	WAIT(task1_flag);

	check_point(0);
}
Exemplo n.º 15
0
static void test_unstr_substr(void)
{
	char *ans[] = {
		"123",
		"unkokko"
	};
	unstr_t *tmp = unstr_init_memory(1);
	unstr_t *emp = unstr_init_memory(1);
	unstr_t *str = unstr_init("1234567890");
	check_assert(unstr_substr(NULL, str, 3) == UNSTRING_FALSE);
	check_assert(unstr_substr(tmp, NULL, 3) == UNSTRING_FALSE);
	check_assert(unstr_substr(tmp, emp, 3) == UNSTRING_FALSE);

	check_assert(unstr_substr(tmp, str, 0) == UNSTRING_TRUE);
	check_assert(unstr_empty(tmp) == UNSTRING_TRUE);

	check_assert(unstr_substr(tmp, str, 3) == UNSTRING_TRUE);
	check_unstr_char(tmp, ans[0]);

	unstr_strcpy_char(str, "unkokkokussakusa");
	check_assert(unstr_substr(tmp, str, 7) == UNSTRING_TRUE);
	check_unstr_char(tmp, ans[1]);

	unstr_delete(3, str, tmp, emp);
}
Exemplo n.º 16
0
void
cpuexc_handler(void *p_excinf)
{
    ER		ercd;

    check_point(4);
    check_state_i(true, true, true, true, false);
    check_assert(xsns_xpn(p_excinf) == true);
    check_assert(xsns_dpn(p_excinf) == true);

#ifdef CANNOT_RETURN_CPUEXC
    check_finish(5);
#endif /* CANNOT_RETURN_CPUEXC */

    check_point(5);
    ercd = iunl_cpu();
    check_ercd(ercd, E_OK);
}
Exemplo n.º 17
0
void
task2(intptr_t exinf)
{
	ER_UINT	ercd;
	PRI		tskpri;

	check_point(14);
	ercd = slp_tsk();
	check_ercd(ercd, E_OK);

	check_point(24);
	ercd = slp_tsk();
	check_ercd(ercd, E_OK);

	check_point(50);
	ercd = loc_mtx(MTX2);
	check_ercd(ercd, E_OK);

	check_point(56);
	ercd = wup_tsk(TASK1);
	check_ercd(ercd, E_OK);

	check_point(57);
	ercd = loc_mtx(MTX1);
	check_ercd(ercd, E_OK);

	check_point(60);
	ercd = unl_mtx(MTX1);
	check_ercd(ercd, E_OK);

	check_point(61);
	ercd = unl_mtx(MTX2);
	check_ercd(ercd, E_OK);

	check_point(62);
	ercd = loc_mtx(MTX1);
	check_ercd(ercd, E_OK);

	check_point(63);
	ercd = rot_rdq(MID_PRIORITY);
	check_ercd(ercd, E_OK);

	check_point(66);
	ercd = unl_mtx(MTX1);
	check_ercd(ercd, E_OK);

	ercd = get_pri(TASK1, &tskpri);
	check_ercd(ercd, E_OK);

	check_assert(tskpri == MID_PRIORITY);

	check_point(67);
	ercd = ext_tsk();

	check_point(0);
}
Exemplo n.º 18
0
void
task2(intptr_t exinf)
{
	ID		tskid;
	ER_UINT	ercd;
	uint_t	load;

	check_point(7);
	ercd = get_lod(TPRI_SELF, &load);
	check_ercd(ercd, E_OK);

	check_assert(load == 3U);

	ercd = get_nth(TPRI_SELF, 0U, &tskid);
	check_ercd(ercd, E_OK);

	check_assert(tskid == TASK2);

	check_point(8);
	ercd = slp_tsk();
	check_ercd(ercd, E_OK);

	check_point(17);
	ercd = get_lod(TPRI_SELF, &load);
	check_ercd(ercd, E_OK);

	check_assert(load == 1U);

	check_point(18);
	ercd = chg_pri(TASK5, MID_PRIORITY);
	check_ercd(ercd, E_OK);

	ercd = get_lod(TPRI_SELF, &load);
	check_ercd(ercd, E_OK);

	check_assert(load == 2U);

	ercd = rot_rdq(TPRI_SELF);
	check_ercd(ercd, E_OK);

	check_point(0);
}
Exemplo n.º 19
0
static void test_unstr_init_memory(void)
{
	unstr_t *str = 0;
	size_t size = 0;
	{
		str = unstr_init_memory(0);
		check_null(str);
		unstr_free(str);
	}{
		size = 10;
		str = unstr_init_memory(size);
		check_assert(str->heap >= size);
		unstr_free(str);
	}{
		size = 1024 * 1024 * 1024;
		str = unstr_init_memory(size);
		check_assert(str->heap >= size);
		unstr_free(str);
	}
}
Exemplo n.º 20
0
void
task1(intptr_t exinf)
{
	ER		ercd;

	test_start(__FILE__);

	check_point(1);

	ercd = ena_tex();
	check_ercd(ercd, E_OK);

	/*
	 *  テスト項目(A)のテスト
	 */
	tex_start_count = 0U;
	ercd = ras_tex(TASK1, 0x0001);
	check_ercd(ercd, E_OK);
	check_assert(tex_start_count == STASK_TEX_COUNT);

	check_point(2);

	/*
	 *  テスト項目(B)のテスト
	 */
	tex_start_count = 0U;
	ercd = ras_tex(TASK1, 0x0002);
	check_ercd(ercd, E_OK);
	check_assert(tex_start_count == STASK_TEX_COUNT);

	check_point(3);

	/*
	 *  この後のテストはTASK3で実施
	 */
	ercd = act_tsk(TASK3);
	check_ercd(ercd, E_OK);

	ercd = ext_tsk();
	check_point(0);
}
Exemplo n.º 21
0
void
task2(intptr_t exinf)
{
	ER_UINT	ercd;
	T_RTSK	rtsk;

	check_point(5);
	ercd = ploc_mtx(MTX1);
	check_ercd(ercd, E_TMOUT);

	ercd = loc_mtx(MTX1);
	check_ercd(ercd, E_OK);

	check_point(13);
	ercd = ref_tsk(TASK2, &rtsk);
	check_ercd(ercd, E_OK);

	check_assert(rtsk.tskpri == HIGH_PRIORITY);

	check_assert(rtsk.tskbpri == MID_PRIORITY);

	ercd = unl_mtx(MTX1);
	check_ercd(ercd, E_OK);

	check_point(14);
	ercd = loc_mtx(MTX1);
	check_ercd(ercd, E_OK);

	check_point(15);
	ercd = slp_tsk();
	check_ercd(ercd, E_OK);

	check_point(18);
	ercd = unl_mtx(MTX1);
	check_ercd(ercd, E_OK);

	check_point(19);
	ercd = ext_tsk();

	check_point(0);
}
Exemplo n.º 22
0
void
cpuexc_handler(void *p_excinf)
{

	check_point(4);
	check_assert(xsns_dpn(p_excinf) == true);

	HOOK_POINT(5);
	return;

	check_point(0);
}
Exemplo n.º 23
0
void
task3(intptr_t exinf)
{
	ER		ercd;
	PRI		tskpri;
	T_RMTX	rmtx;

	check_point(10);
	ercd = loc_mtx(MTX1);
	check_ercd(ercd, E_OK);

	check_point(13);
	ercd = ref_mtx(MTX1, &rmtx);
	check_ercd(ercd, E_OK);
	check_assert(rmtx.htskid == TASK3);
	check_assert(rmtx.wtskid == TSK_NONE);

	ercd = get_pri(TPRI_SELF, &tskpri);
	check_ercd(ercd, E_OK);
	check_assert(tskpri == HIGH_PRIORITY);

	ercd = unl_mtx(MTX1);
	check_ercd(ercd, E_OK);

	ercd = slp_tsk();
	check_ercd(ercd, E_OK);

	check_point(27);
	ercd = loc_mtx(MTX1);
	check_ercd(ercd, E_OK);

	check_point(30);
	ercd = ref_mtx(MTX1, &rmtx);
	check_ercd(ercd, E_OK);
	check_assert(rmtx.htskid == TASK3);
	check_assert(rmtx.wtskid == TSK_NONE);

	ercd = ref_mtx(MTX2, &rmtx);
	check_ercd(ercd, E_OK);
	check_assert(rmtx.htskid == TASK4);
	check_assert(rmtx.wtskid == TSK_NONE);

	ercd = get_pri(TPRI_SELF, &tskpri);
	check_ercd(ercd, E_OK);
	check_assert(tskpri == HIGH_PRIORITY);

	ercd = ext_tsk();

	check_point(0);
}
Exemplo n.º 24
0
void
tex_task2(TEXPTN texptn, intptr_t exinf)
{
	ER_UINT	ercd;

	switch (++tex_task2_count) {
	case 1:
		check_point(29);
		check_assert(texptn == 0x0001);

		check_state(false, false, TIPM_ENAALL, false, false, true);

		return;

		check_point(0);

	case 2:
		check_point(31);
		check_assert(texptn == 0x0002);

		check_state(false, false, TIPM_ENAALL, false, false, true);

		check_point(32);
		ercd = dis_dsp();
		check_ercd(ercd, E_OK);

		ercd = rot_rdq(TPRI_SELF);
		check_ercd(ercd, E_OK);

		check_point(33);
		return;

		check_point(0);

	default:
		check_point(0);
	}
	check_point(0);
}
Exemplo n.º 25
0
static void test_unstr_sprintf(void)
{
	unstr_t *tmp = 0;
	unstr_t *p1 = 0;

	tmp = unstr_sprintf(NULL, NULL);
	check_assert(tmp == NULL);

	tmp = unstr_sprintf(NULL, "");
	check_assert(tmp != NULL);
	unstr_free(tmp);

	tmp = unstr_sprintf(NULL, "|%d|", 1234567890);
	check_unstr_char(tmp, "|1234567890|");

	unstr_sprintf(tmp, "%x|", 0x5aa5aa55);
	check_unstr_char(tmp, "5aa5aa55|");

	unstr_sprintf(tmp, "|%X", 0x55AA5AA5);
	check_unstr_char(tmp, "|55AA5AA5");

	unstr_sprintf(tmp, "%s%s", "AaA", "bBb");
	check_unstr_char(tmp, "AaAbBb");

	p1 = unstr_init("unko");
	unstr_sprintf(tmp, "%%$%$%%$", p1);
	check_unstr_char(tmp, "%$unko%$");
	unstr_free(p1);

	unstr_sprintf(tmp, "%d == %x == %X", 255, 0xff, 0xFF);
	check_unstr_char(tmp, "255 == ff == FF");

	p1 = unstr_init("456");
	unstr_sprintf(tmp, "%s->%$->%d", "123", p1, 789);
	check_unstr_char(tmp, "123->456->789");
	unstr_free(p1);

	unstr_free(tmp);
}
Exemplo n.º 26
0
void
task3(intptr_t exinf)
{
	ER_UINT	ercd;

	check_point(7);
	ercd = snd_mbf(MBF1, string2, 26);
	check_ercd(ercd, E_OK);

	check_point(12);
	ercd = wup_tsk(TASK1);
	check_ercd(ercd, E_OK);

	check_point(14);
	ercd = snd_mbf(MBF1, string3, 10);
	check_ercd(ercd, E_OK);

	check_point(18);
	ercd = snd_mbf(MBF1, string2, 26);
	check_ercd(ercd, E_OK);

	check_point(20);
	check_assert(strncmp(buf1, string2, 26) == 0);

	ercd = rcv_mbf(MBF1, buf1);
	check_ercd(ercd, 26);

	check_assert(strncmp(buf1, string1, 26) == 0);

	ercd = chg_pri(TASK2, TPRI_INI);
	check_ercd(ercd, E_OK);

	check_point(21);
	ercd = snd_mbf(MBF1, string1, 26);
	check_ercd(ercd, E_OK);

	check_point(0);
}
Exemplo n.º 27
0
void
cpuexc_handler(void *p_excinf)
{
	ER		ercd;

	switch (++cpuexc_count) {
	case 1:
		check_point(3);
		check_state_i(true, false, false, true, false);
		check_assert(xsns_xpn(p_excinf) == false);
		check_assert(xsns_dpn(p_excinf) == false);

		check_point(4);
		ercd = iact_tsk(TASK2);
		check_ercd(ercd, E_OK);
		ercd = iloc_cpu();
		check_ercd(ercd, E_OK);
		break;

	case 2:
		check_point(11);
		check_state_i(true, false, false, true, false);
		check_assert(xsns_xpn(p_excinf) == false);
		check_assert(xsns_dpn(p_excinf) == false);

		check_point(12);
		ercd = iras_tex(TASK1, 1U);
		check_ercd(ercd, E_OK);
		ercd = iloc_cpu();
		check_ercd(ercd, E_OK);
		break;

	default:
		check_point(0);
		break;
	}
}
Exemplo n.º 28
0
void
task4(intptr_t exinf)
{
	ID		tskid;
	ER_UINT	ercd;
	uint_t	load;

	check_point(11);
	ercd = get_lod(TPRI_SELF, &load);
	check_ercd(ercd, E_OK);

	check_assert(load == 1U);

	ercd = get_nth(TPRI_SELF, 0U, &tskid);
	check_ercd(ercd, E_OK);

	check_assert(tskid == TASK4);

	check_point(12);
	ercd = slp_tsk();
	check_ercd(ercd, E_OK);

	check_point(0);
}
Exemplo n.º 29
0
void
task3(intptr_t exinf)
{
	ER_UINT	ercd;
	ID		somid;

	check_point(3);
	WAIT(task3_flag);

	check_point(6);
	WAIT(task3_flag);

	check_point(9);
	WAIT(task3_flag);

	check_point(11);
	WAIT(task3_flag);

	check_point(12);
	WAIT(task3_flag);

	check_point(15);
	ercd = chg_som(TSOM_STP);
	check_ercd(ercd, E_OK);

	ercd = get_som(&somid);
	check_ercd(ercd, E_OK);

	check_assert(somid == SOM2);

	check_point(16);
	WAIT(task3_flag);

	check_point(21);
	ercd = chg_som(TSOM_STP);
	check_ercd(ercd, E_OK);

	WAIT(task3_flag);

	check_point(27);
	ercd = chg_som(TSOM_STP);
	check_ercd(ercd, E_OK);

	WAIT(task3_flag);

	check_finish(32);
	check_point(0);
}
Exemplo n.º 30
0
static void test_unstr_strcmp(void)
{
	unstr_t *str = unstr_init("1234567890");
	unstr_t *ans = unstr_copy(str);
	unstr_t *ans_fail = unstr_init("1234567891");
	unstr_t *emp = unstr_init_memory(1);
	check_assert(unstr_strcmp(NULL, str) == 0x100);
	check_assert(unstr_strcmp(NULL, emp) == 0x100);
	check_assert(unstr_strcmp(str, NULL) == 0x100);
	check_assert(unstr_strcmp(str, emp) == 0x100);
	check_assert(unstr_strcmp(emp, str) == 0x100);

	check_assert(unstr_strcmp(str, ans) == 0);
	check_assert(unstr_strcmp(str, ans_fail) < 0);
	check_assert(unstr_strcmp(ans_fail, str) > 0);

	unstr_delete(4, str, ans, ans_fail, emp);
}