コード例 #1
0
void ContainerUnitTest::execute() {
	std::cout << "Stack<long>" << std::endl;
	Stack<long> stack1;
	testStack(&stack1);

	std::cout << "Stack<char*>" << std::endl;
	Stack<char*> stack2;
	testStack(&stack2);

	std::cout << "Queue<long>" << std::endl;
	Queue<long> queue1;
	testQueue(&queue1);

	std::cout << "Queue<char*>" << std::endl;
	Queue<long> queue2;
	testQueue(&queue2);

}
コード例 #2
0
ファイル: ceptr_specs.c プロジェクト: ChunHungLiu/ceptr
int main(int argc, const char **argv) {
    printf("Running all tests...\n\n");

    //**** core tests
    testTree();
    testParse();
    testDef();
    testWord();
    testFlow();
    testVM();


    testStack();
    testInit();
    testCommand();
    testConversation();
    testScape();


//    testThreads();

    //**** builtins tests
    testNoun();
    testPattern();
    //testArray();
    //    testStream();
    testInt();
    testStr255();
    testCfunc();
    testReceptorUtil();
    //    testReceptor();
    //testVmHost();

    //**** examples test
    testPoint();
    //    testLine();


    report_tests();
    return 0;
}
コード例 #3
0
ファイル: deque.c プロジェクト: nks5295/lightwave
VOID
TestDequeCode(
    PVMDIR_TEST_STATE pState
    )
{
    DWORD dwError = 0;
    PDEQUE pDeque = NULL;

    printf("Testing deque code ...");

    dwError = dequeCreate(&pDeque);
    TestAssertEquals(dwError, ERROR_SUCCESS);

    testEmpty(pState, pDeque);
    testQueue(pState, pDeque);
    testStack(pState, pDeque);
    testEmpty(pState, pDeque);

    dequeFree(pDeque);

    printf(" PASSED\n");
}
コード例 #4
0
ファイル: testMemory.cpp プロジェクト: peakflys/testcode
int main(int argc, char* argv[])
{
    if(argc < 3)
    {
        printf("usage: ./memory 100 10");
        return 0;
    }
    testStack(atoi(argv[1]),atoi(argv[2]));
    printf("finish function stack test\n");
    int* pt = testHeap(atoi(argv[1]),atoi(argv[2]));
    printf("finish function heap test\n");
    getchar();
    int* pt1 = testHeap(atoi(argv[1]),atoi(argv[2]));
    printf("finish function heap test\n");
    getchar();
    delete [] pt;
    printf("delete pt heap memory\n");
    getchar();
    delete [] pt1;
    printf("delete pt1 heap memory\n");
    getchar();
    return 0;
}
コード例 #5
0
// ---------------------------------------------------------------------------
//  Test entry point
// ---------------------------------------------------------------------------
static bool basicTests()
{
    RefStackOf<double> testStack(500);

    return true;
}
コード例 #6
0
ファイル: main.c プロジェクト: JacobSeibel/OldSampleCode
void main(int argc, char *argv[]){

    char *filename = argv[1];
    FILE *fp;

    if(strcmp(filename, "-s") == 0){
        testStack();
        exit(0);
    }
    if(strcmp(filename, "-t") == 0){
        testTable();
        exit(0);
    }
    if(strcmp(filename, "-i") == 0){
        testInstruction();
        exit(0);
    }


    if(argc == 1){
        printf("Proper use: wi <filename.wic>\n");
        exit(0);
    }
    else if((fp = fopen(filename, "r")) == NULL)
    {
        printf("Error opening file.  File doesn't exist.\n");
        exit(0);
    }
    
    initialize();

    char opcode[OPCODE_SIZE];
    char operand[OPERAND_SIZE];
    int address = 0;
    while(fscanf(fp, "%s", opcode) != EOF){
        if(hasOperand(opcode)){
            if(fscanf(fp, "%s", operand) == EOF){
                insertInstruction(address, opcode, operand);
                address++;
                break;
            }
        }
        if(!validOp(opcode)){
            if(fscanf(fp, "%s", operand) != EOF && strcmp(operand, "label") == 0){
                char temp[OPERAND_SIZE];
                strcpy(temp, operand);
                strcpy(operand, opcode);
                strcpy(opcode, temp);
            }
            else{
                printf("Invalid opcode: %s\n", opcode);
                exit(0);
            }
        }
        else if(hasOperand(opcode) == 0){
            strcpy(operand, "");
        }
        insertInstruction(address, opcode, operand);
        address++;
        //discard the rest of the line
        while(fgetc(fp) != '\n'){};
    }
    fclose(fp);

    runProgram();
}