#include "stdio.h" #include "gloval_variables.h" #include "function.h" int main(void){ static char *sel[]={"Select Number = "}; int first,second,third,fourth,fifth[5],i; char buf[1]; printf("\nStart test of functions!\n\n"); printf("Select test number.\n"); printf(" 0:irs_function test \n 1:ts_function test \n"); printf(" 2:lcd_function test\n 3:uss_function test\n \n\n"); printf("%s",sel[0]); scanf("%d",&first); printf("\n"); switch(first){ case 0: do{ printf("test of [irs_function]\n"); printf("Select irs number.\n"); printf(" 1:irs1\n 2:irs2\n"); printf("%s",sel[0]); scanf("%d",&second); printf("\n"); irs_ts_init(); write_irs(second); third=read_irs(); irs_ts_cleanup(); printf("post_number ---> %d\n",third); printf("success koyama?\n"); printf("irs_function test again?[y/n]="); scanf("%s",buf); printf("\n\n"); }while(buf[0] != 'n'); break; case 1: irs_ts_init(); do{ printf("test of [int read_ts();]\n"); // irs_ts_init(); printf("Ready Koyama?[y/n]="); scanf("%s",buf); printf("\n\n"); second=read_ts(); printf("ts_return ---> %d\n",second); printf("success koyama?\n"); // irs_ts_cleanup(); printf("ts_function test again?[y/n]="); scanf("%s",buf); printf("\n\n"); }while(buf[0] != 'n'); irs_ts_cleanup(); break; case 2: do{ printf("test of [int print_lcd(char buf[]);]\n"); print_lcd("Test is successful!\n"); printf("lcd_function test again?[y/n]="); scanf("%s",buf); printf("\n\n"); }while(buf[0] != 'n'); break; case 3: do{ printf("Select uss_function .\n"); printf(" 0:[int uss_get(--,--);]\n 1:[int uss_get3(int *data_array);] \n"); printf("%s",sel[0]); scanf("%d",&second); printf("\n"); uss_init(); switch(second){ case 0: do{ printf("Select uss_number[1,2,3,4].\n"); printf("%s",sel[0]); scanf("%d",&third); printf("\n"); fourth = 555; uss_get(third,&fourth); printf("uss[%d]=%d[cm]\n",third,fourth); printf("Measure soon, Koyama!!\n"); printf("this_function test again?[y/n]="); scanf("%s",buf); printf("\n\n"); }while(buf[0] != 'n'); break; case 1: do{ printf("Koyama, Ready? [y/n]="); scanf("%s",buf); printf("\n\n"); uss_get3(fifth); for(i=0;i<3;i++){ printf("uss[%d]=%d[cm]\n",i+1,fifth[i]); } printf("this_function test again?[y/n]="); scanf("%s",buf); printf("\n\n"); }while(buf[0] != 'n'); break; default : } uss_cleanup(); printf("uss_function test again?[y/n]="); scanf("%s",buf); printf("\n\n"); }while(buf[0] != 'n'); break; default : } return 0; }