int main(void) { int result = 1; if (!ReadTest(L"C:\\audio\\test.flac")) { printf("ReadTest failed\n"); goto end; } if (!WriteTest(L"C:\\audio\\testW.flac")) { printf("WriteTest failed\n"); goto end; } result = 0; end: if (gPcmByChannel) { for (int ch=0; ch<gMeta.channels; ++ch) { delete [] gPcmByChannel[ch]; gPcmByChannel[ch] = NULL; } delete [] gPcmByChannel; gPcmByChannel = NULL; } return result; }
void main(int argc,char ** argv) { char* trainfile = (argc > 1) ? argv[1] : TRAIN_FILE; char* testfile = (argc > 2) ? argv[2] : TEST_INPUT_FILE; char* outfile = (argc > 3) ? argv[3] : TEST_OUTPUT_FILE; TIME_COUNT("平均值测试",true); int len; auto rates = LoadRates(trainfile, len); double * avg=GetAvg(rates, len); delete[] rates; TIME_COUNT("读取数据"); //auto t = LoadRates(TEST_BIN_FILE, len); auto test = ReadTest(testfile); int n = 0; for (auto t = test.begin(); t != test.end();++t) { for (size_t i = 0; i < t->N; i++) { t->ratings[i].rank = avg[n]; } n++; } SaveTest(test,outfile); TIME_COUNT("生成结果测试"); system("pause"); }
int main(int argc, char** argv) { cout << "线性回归分析\n \t参数1:二进制训练集文件;\n\t参数2:测试集文件\n\t参数3:输出文件\n"; TIME_COUNT("线性回归分析",true); int n; char* trainfile = (argc > 1) ? argv[1] : TRAIN_FILE; cout << "载入训练集(" << trainfile << ")...\n"; auto rates = LoadRates(trainfile, n); cout << "载入item属性(" << ITEM_ATTR_FILE << ")...\n"; auto attrs = LoadAttr(); TIME_COUNT("数据载入"); cout << "开始线性回归分析...\n"; double** beta = analysis(attrs, rates, n); delete[] rates; char* betafile = "beta.txt"; cout << "分析完成,导出BETA矩阵(" << betafile << ")...\n"; PrintBeta(beta, n, betafile); TIME_COUNT("计算分析"); char* testfile = (argc > 2) ? argv[2] : TEST_INPUT_FILE; cout << "\n载入测试集(" << testfile << ")...\n"; auto test = ReadTest(testfile); cout << "线性回归计算...\n"; LinearRate(beta, test, attrs); for (size_t i = 0; i < n; i++) { delete[] beta[i]; } delete[]beta; attrs.clear(); TIME_COUNT("处理测试数据"); char* output = (argc > 3) ? argv[3] : TEST_OUTPUT_FILE; cout << "\n导出测试结果(" << output << ")\n"; SaveTest(test, output); test.clear(); system("pause"); }
BOOL ReadTestCycl( __in CDevice *pDev, __in BOOLEAN ovrl ) { int ch; for (;;) { if(!ReadTest(pDev, ovrl)) return FALSE; if(_kbhit()) { ch = getchar(); if(ch == EOF) break; putchar(ch); } } return TRUE; }
//================================================ void DriverFSU15_C() { BYTE i; __DI(); i=ADDR; Fsu15.Info.bits.Addr =i; if(i!=ADDR_NODE) { setState(Initialisation); ADDR_NODE =ADDR; } Fsu15.Info.bits.Mode=MODE; Fsu15.Info.bits.F1=PG_F1; #ifdef PLATA_FSU15 Fsu15.Info.bits.F2=PG_F2; #endif WriteOutput(); ReadTest(); __EI(); }
int main(int argc, char *argv[]) { if(argc<2) { err: cout << "Arguments: " << endl; cout << " " << argv[0] << " r <uin> # read test" << endl; cout << " " << argv[0] << " w <uin> # write test" << endl; cout << " " << argv[0] << " rw <uin> # read and write test" << endl; cout << " " << argv[0] << " wr <uin> # write and read test" << endl; cout << " " << argv[0] << " pc <subkey_num> <field_num> # decode/encode pressure test" << endl; cout << " " << argv[0] << " pe <subkey_num> <field_num> # extract pressure test" << endl; cout << " " << argv[0] << " f # test field api" << endl; return 1; } if(strcmp(argv[1], "r")==0) { if(ReadTest(argc>2? strtoul(argv[2],NULL,10):12345678)==0) cout << "Read successfully." << endl; return 0; } if(strcmp(argv[1], "w")==0) { if(WriteTest(argc>2? strtoul(argv[2],NULL,10):12345678)==0) cout << "Write successfully." << endl; return 0; } if(strcmp(argv[1], "rw")==0) { if(ReadTest(argc>2? strtoul(argv[2],NULL,10):12345678)==0) { cout << "Read successfully." << endl; if(WriteTest(argc>2? strtoul(argv[2],NULL,10):12345678)==0) cout << "Write successfully." << endl; } return 0; } if(strcmp(argv[1], "wr")==0) { if(WriteTest(argc>2? strtoul(argv[2],NULL,10):12345678)==0) { cout << "Write successfully." << endl; if(ReadTest(argc>2? strtoul(argv[2],NULL,10):12345678)==0) cout << "Read successfully." << endl; } return 0; } if(strcmp(argv[1], "pc")==0 && argc==4) { if(PressTest(atoi(argv[2]), atoi(argv[3]), false)==0) cout << "Encode/Decode press test successfully." << endl; return 0; } if(strcmp(argv[1], "pe")==0 && argc==4) { if(PressTest(atoi(argv[2]), atoi(argv[3]), true)==0) cout << "Extract press test successfully." << endl; return 0; } if(strcmp(argv[1], "f")==0) { if(FieldTest(1)==0) cout << "Field test successfully." << endl; return 0; } goto err; }
int main(int argc, char **argv) { int i; char ts[50]; //timestring int cc; //current counter (9S08QG8) int hc[4]; //hour counter (9S08QG8) char tv[2]; //temperatur value (LM75) if(argc == 2){ if(strncmp(argv[1],"-V",2) == 0){ verbose_max = true; verbose = true; }else if(strncmp(argv[1],"-v",2) == 0){ verbose = true; }else if(strncmp(argv[1],"-r",2) == 0){ readtest = true; }else if(strncmp(argv[1],"-w",2) == 0){ writetest = true; }else if(strncmp(argv[1],"-c",2) == 0){ verbose = true; calibrate_9s08 = true; }else if(strncmp(argv[1],"-d",2) == 0){ ValueToDatabase(false,"2015-07-23 00:00:00",1,2,3,10,11,12,13); }else if(strncmp(argv[1],"-t",2) == 0){ verbose = true; ThreadPowerOff(); return(0); }else if(strncmp(argv[1],"-T",2) == 0){ //verbose_max = true; verbose = true; restoredata_9S08 = true; } }else if(argc == 4){ if(strncmp(argv[1],"-p",2) == 0){ printf("v1: %s\n",argv[1]); printf("v2: %s\n",argv[2]); printf("v3: %s\n",argv[3]); if(strncmp(argv[2],"1",1) == 0){ int val = atoi(argv[3]); printf("val: %d\n",val); SetPWM(1,val); }else if(strncmp(argv[2],"2",1) == 0){ int val = atoi(argv[3]); SetPWM(2,val); } return(0); } } if(readtest){ ReadTest(); return(0); } if(writetest){ WriteTest(); return(0); } if(calibrate_9s08){ Calibrate9s08(); return(0); } if(restoredata_9S08){ BackupValueFromDatabase(&cc,&hc[0],&hc[1],&hc[2],&hc[3]); SetCounterValue_MC9S08QG8(cc); if(verbose){ printf("counter: %d\n",cc); } for(i=0;i<4;i++){ SetHourCounterValue_MC9S08QG8(i,hc[i]); if(verbose){ printf("hourcounter [%d]: %d\n",i,hc[i]); } } return(0); } strcpy(ts,GetDateTimeString()); if(verbose){ printf("Uhrzeit: %s\n",ts); } cc = GetCounterValue_MC9S08QG8(); if(verbose){ printf("counter: %d\n",cc); } for(i=0;i<4;i++){ hc[i] = GetHourCounterValue_MC9S08QG8(i); if(verbose){ printf("hourcounter [%d]: %d\n",i,hc[i]); } } for(i=0;i<2;i++){ tv[i] = GetTemperaturValue_LM75_8Bit(i); if(verbose){ printf("LM75.%d temperature: %d\n",i,tv[i]); } } ValueToDatabase(false,ts,cc,tv[0],tv[1],hc[0],hc[1],hc[2],hc[3]); return(0); }