int main() { TerminalState *state = new VTTerminalState(); Logger::getInstance()->setLogLevel(Logger::ERROR); state->enableShiftText(true); //Populate test data. for (int i = 0; i < 40; i++) { for (int j = 0; j < 80; j++) { terminalBuffer[i][j] = (rand() % 95) + 32; } } testInit(state); testCursor(state); testOrigin(state); testCursorMoveBackward(state); testCursorMoveForward(state); testCursorMoveUp(state); testCursorMoveDown(state); state->addTerminalModeFlags(TS_TM_ORIGIN); testCursorMoveBackward(state); testCursorMoveForward(state); state->removeTerminalModeFlags(TS_TM_ORIGIN); testCursorMoveUpOrigin(state); testCursorMoveDownOrigin(state); testInsert(state); testExpandedBuffer(state); testErase(state); testInsertShift(state); testDelete(state); testVT((VTTerminalState *)state); testGraphicsState(); delete state; return 0; }
/****************************************************************************************** * 测试向量 ******************************************************************************************/ int main ( int argc, char* argv[] ) { if ( 2 > argc ) { printf ( "Usage: %s <size of test>\a\a\n", argv[0] ); return 1; } srand ( ( unsigned int ) time ( NULL ) ); //设置随机种子 testCursor ( atoi ( argv[1] ) ); //元素类型可以在这里任意选择 return 0; }