Ejemplo n.º 1
0
void Forth_test_stdwords(bool verbose) {
    ForthEnv env;
    Reporter reporter;

    for (size_t i = 0; i < SK_ARRAY_COUNT(gRecs); i++) {
        ForthEngine engine(NULL);
        
        ForthWord* word = env.findWord(gRecs[i].fName);
        if (NULL == word) {
            SkString str;
            str.printf("--- can't find stdword %d", gRecs[i].fName);
            reporter.reportFailure(str.c_str());
        } else {
            if (verbose) {
                SkDebugf("--- testing %s %p\n", gRecs[i].fName, word);
            }
            gRecs[i].fProc(word, &engine, &reporter);
        }
    }
    
    if (0 == reporter.fFailureCount) {
        SkDebugf("--- success!\n");
    } else {
        SkDebugf("--- %d failures\n", reporter.fFailureCount);
    }
}