Exemple #1
0
Fichier : main.c Projet : aaasz/SHP
int main() {
    int one_out1, one_out2, one_out3;
    int two_out, three_out, four_out;
    int five_out1, five_out2;
    int six_out, seven_out;
    int eight_out;
    xil_printf("Microblaze:\n");
    XTmrCtr_Initialize(&TimerInst, 0);
    XTmrCtr_SetResetValue(&TimerInst, 0, 0);
    XTmrCtr_Start(&TimerInst, 0);
    StartIF_TS = XTmrCtr_GetValue(&TimerInst, 0);
    function_one(10000000, &one_out1, &one_out2, &one_out3);
    function_two(one_out1, &two_out);
    function_three(one_out2, &three_out);
    function_four(one_out3, &four_out);
    function_five(two_out, three_out, four_out, &five_out1, &five_out2);
    function_six(five_out1, &six_out);
    function_seven(five_out2, &seven_out);
    function_eight(six_out, seven_out, &eight_out);
    xil_printf("Rezultat = %d \n", eight_out);
    FinishIF_TS = XTmrCtr_GetValue(&TimerInst, 0);
    TimeSA = (FinishIF_TS - StartIF_TS) / (50000000 / 1000);
    xil_printf("0\n");
    xil_printf("%d\n", TimeSA);
    xil_printf("SERIALSTOP");
    return 0;
}
	std::cout << "\nResult: " << result;
	return 0;
}

//*/



TEST_CASE ( "Calling C++ version of each function", "[c-all-methods]" ) {
    REQUIRE ( function_zero ( ) == 200 );
	REQUIRE ( function_one ( 10 ) == 30 );
	REQUIRE ( function_two ( 10, 20 ) == 30 );
	REQUIRE ( function_three ( 10, 20, 30 ) == 60 );
	REQUIRE ( function_four ( 10, 20, 30, 40 ) == 100 );
	REQUIRE ( function_five ( 10, 20, 30, 40, 50 ) == 150 );
	REQUIRE ( function_six ( 10, 20, 30, 40, 50, 60 ) == 210 );
}

TEST_CASE ( "Calling 0-parameter assembly function", "[c-method-0-parm]" ) {
 	REQUIRE ( func_0 ( ) == 300 );
}

TEST_CASE ( "Calling 1-parameter assembly function", "[c-method-1-parm]" ) {
	REQUIRE ( func_1 ( 10 ) == 30 );
	REQUIRE ( func_1 ( 20 ) == 60 );
	REQUIRE ( func_1 ( 30 ) == 90 );
}

TEST_CASE ( "Calling 2-parameter assembly function", "[c-method-2-parm]" ) {
	REQUIRE ( func_2 ( 1, 2 ) == 3 );