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);

}
Ejemplo n.º 2
0
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;
}
Ejemplo n.º 3
0
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");
}
Ejemplo n.º 4
0
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;
}
// ---------------------------------------------------------------------------
//  Test entry point
// ---------------------------------------------------------------------------
static bool basicTests()
{
    RefStackOf<double> testStack(500);

    return true;
}
Ejemplo n.º 6
0
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();
}