示例#1
0
void
TestMemory_Run_IMP(TestMemory *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 30);
    test_oversize__growth_rate(runner);
    test_oversize__ceiling(runner);
    test_oversize__rounding(runner);
}
示例#2
0
void
TestSnapshot_Run_IMP(TestSnapshot *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 9);
    test_Add_and_Delete(runner);
    test_path_handling(runner);
    test_Read_File_and_Write_File(runner);
}
示例#3
0
void
TestNormalizer_Run_IMP(TestNormalizer *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 21);
    test_Dump_Load_and_Equals(runner);
    test_normalization(runner);
    test_utf8proc_normalization(runner);
}
示例#4
0
void
TestStrHelp_Run_IMP(TestStringHelper *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 14);
    test_overlap(runner);
    test_to_base36(runner);
    test_back_utf8_char(runner);
}
示例#5
0
void
TestIOChunks_Run_IMP(TestIOChunks *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 36);
    srand((unsigned int)time((time_t*)NULL));
    test_Align(runner);
    test_Read_Write_Bytes(runner);
    test_Buf(runner);
}
示例#6
0
void
TestFSFH_Run_IMP(TestFSFileHandle *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 46);
    test_open(runner);
    test_Read_Write(runner);
    test_Close(runner);
    test_Window(runner);
}
示例#7
0
void
TestInStream_Run_IMP(TestInStream *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 37);
    test_refill(runner);
    test_Clone_and_Reopen(runner);
    test_Close(runner);
    test_Seek_and_Tell(runner);
}
示例#8
0
void
TestPriQ_Run_IMP(TestPriorityQueue *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 17);
    test_Peek_and_Pop_All(runner);
    test_Insert_and_Pop(runner);
    test_discard(runner);
    test_random_insertion(runner);
}
示例#9
0
void
TestCFWriter_Run_IMP(TestCompoundFileWriter *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 7);
    S_init_strings();
    test_Consolidate(runner);
    test_offsets(runner);
    S_destroy_strings();
}
示例#10
0
void
TestFSFolder_Run_IMP(TestFSFolder *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self,
                          TestFolderCommon_num_tests() + 9);
    test_Initialize_and_Check(runner);
    TestFolderCommon_run_tests(runner, S_set_up, S_tear_down);
    test_protect_symlinks(runner);
    test_disallow_updir(runner);
}
示例#11
0
void
TestBB_Run_IMP(TestByteBuf *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 21);
    test_Equals(runner);
    test_Grow(runner);
    test_Clone(runner);
    test_compare(runner);
    test_Mimic(runner);
    test_Cat(runner);
}
示例#12
0
void
TestObj_Run_IMP(TestObj *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 17);
    test_refcounts(runner);
    test_To_String(runner);
    test_Equals(runner);
    test_Hash_Sum(runner);
    test_Is_A(runner);
    test_abstract_routines(runner);
}
示例#13
0
void
TestSeg_Run_IMP(TestSegment *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 21);
    test_fields(runner);
    test_metadata_storage(runner);
    test_seg_name_and_num(runner);
    test_count(runner);
    test_Compare_To(runner);
    test_Write_File_and_Read_File(runner);
}
示例#14
0
void
TestBB_Run_IMP(TestByteBuf *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 17);
    test_Equals(runner);
    test_Grow(runner);
    test_Clone(runner);
    test_Compare_To(runner);
    test_Utf8_To_String(runner);
    test_Cat(runner);
}
示例#15
0
void
TestStrHelp_Run_IMP(TestStringHelper *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 40);
    test_overlap(runner);
    test_to_base36(runner);
    test_utf8_round_trip(runner);
    test_utf8_valid(runner);
    test_is_whitespace(runner);
    test_back_utf8_char(runner);
}
示例#16
0
void
TestCFReader_Run_IMP(TestCompoundFileReader *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 48);
    S_init_strings();
    test_open(runner);
    test_Local_MkDir_and_Find_Folder(runner);
    test_Local_Delete_and_Exists(runner);
    test_Local_Open_Dir(runner);
    test_Local_Open_FileHandle(runner);
    test_Local_Open_In(runner);
    test_Close(runner);
    S_destroy_strings();
}
示例#17
0
void
TestFH_Run_IMP(TestFileHandle *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 2);

    FileHandle *fh  = S_new_filehandle();
    String     *foo = SSTR_WRAP_UTF8("foo", 3);

    TEST_TRUE(runner, Str_Equals_Utf8(FH_Get_Path(fh), "", 0), "Get_Path");
    FH_Set_Path(fh, foo);
    TEST_TRUE(runner, Str_Equals(FH_Get_Path(fh), (Obj*)foo), "Set_Path");

    DECREF(fh);
}
示例#18
0
void
TestNumUtil_run(TestNumberUtils *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 1196);
    srand((unsigned int)time((time_t*)NULL));
    test_u1(runner);
    test_u2(runner);
    test_u4(runner);
    test_c32(runner);
    test_c64(runner);
    test_bigend_u16(runner);
    test_bigend_u32(runner);
    test_bigend_u64(runner);
    test_bigend_f32(runner);
    test_bigend_f64(runner);
}
示例#19
0
void
TestRAMFolder_run(TestRAMFolder *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 98);
    S_init_strings();
    test_Initialize_and_Check(runner);
    test_Local_Exists(runner);
    test_Local_Is_Directory(runner);
    test_Local_Find_Folder(runner);
    test_Local_MkDir(runner);
    test_Local_Open_Dir(runner);
    test_Local_Open_FileHandle(runner);
    test_Local_Delete(runner);
    test_Rename(runner);
    test_Hard_Link(runner);
    test_Close(runner);
    S_destroy_strings();
}
示例#20
0
void
TestCB_Run_IMP(TestCharBuf *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 21);
    test_vcatf_s(runner);
    test_vcatf_null_string(runner);
    test_vcatf_str(runner);
    test_vcatf_obj(runner);
    test_vcatf_null_obj(runner);
    test_vcatf_i8(runner);
    test_vcatf_i32(runner);
    test_vcatf_i64(runner);
    test_vcatf_u8(runner);
    test_vcatf_u32(runner);
    test_vcatf_u64(runner);
    test_vcatf_f64(runner);
    test_vcatf_x32(runner);
    test_Cat(runner);
    test_Mimic_and_Clone(runner);
}
示例#21
0
void
TestBitVector_Run_IMP(TestBitVector *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 1029);
    test_Set_and_Get(runner);
    test_Flip(runner);
    test_Flip_Block_ascending(runner);
    test_Flip_Block_descending(runner);
    test_Flip_Block_bulk(runner);
    test_Mimic(runner);
    test_Or(runner);
    test_Xor(runner);
    test_And(runner);
    test_And_Not(runner);
    test_Count(runner);
    test_Next_Hit(runner);
    test_Clear_All(runner);
    test_Clone(runner);
    test_To_Array(runner);
    test_off_by_one_error();
}
示例#22
0
void
TestStr_Run_IMP(TestString *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 139);
    test_new(runner);
    test_Cat(runner);
    test_Clone(runner);
    test_Code_Point_At_and_From(runner);
    test_Contains_and_Find(runner);
    test_SubString(runner);
    test_Trim(runner);
    test_To_F64(runner);
    test_To_I64(runner);
    test_To_String(runner);
    test_To_Utf8(runner);
    test_To_ByteBuf(runner);
    test_Length(runner);
    test_Compare_To(runner);
    test_Starts_Ends_With(runner);
    test_Get_Ptr8(runner);
    test_iterator(runner);
    test_iterator_whitespace(runner);
    test_iterator_substring(runner);
}
示例#23
0
文件: TestJson.c 项目: rectang/lucy
void
TestJson_Run_IMP(TestJson *self, TestBatchRunner *runner) {
    uint32_t num_tests = 105;
#ifndef LUCY_VALGRIND
    num_tests += 28; // FIXME: syntax errors leak memory.
#endif
    TestBatchRunner_Plan(runner, (TestBatch*)self, num_tests);

    // Test tolerance, then liberalize for testing.
    test_tolerance(runner);
    Json_set_tolerant(true);

    test_to_and_from(runner);
    test_escapes(runner);
    test_numbers(runner);
    test_spew_and_slurp(runner);
    test_integers(runner);
    test_floats(runner);
    test_max_depth(runner);

#ifndef LUCY_VALGRIND
    test_syntax_errors(runner);
#endif
}
示例#24
0
void
TestCaseFolder_Run_IMP(TestCaseFolder *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 6);
    test_Dump_Load_and_Equals(runner);
    test_analysis(runner);
}
示例#25
0
void
TestStandardTokenizer_Run_IMP(TestStandardTokenizer *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 1378);
    test_Dump_Load_and_Equals(runner);
    test_tokenizer(runner);
}
示例#26
0
文件: TestSimple.c 项目: kidaa/lucy
void
TestSimple_Run_IMP(TestSimple *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 7);
    test_simple(runner);
}
示例#27
0
void
TestSeriesMatcher_Run_IMP(TestSeriesMatcher *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 135);
    test_matrix(runner);
}
示例#28
0
void
TestQPLogic_Run_IMP(TestQueryParserLogic *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 258);

    uint32_t i;
    Folder        *folder     = S_create_index();
    IndexSearcher *searcher   = IxSearcher_new((Obj*)folder);
    QueryParser   *or_parser  = QParser_new(IxSearcher_Get_Schema(searcher),
                                            NULL, NULL, NULL);
    String        *AND        = SSTR_WRAP_C("AND");
    QueryParser   *and_parser = QParser_new(IxSearcher_Get_Schema(searcher),
                                            NULL, AND, NULL);
    QParser_Set_Heed_Colons(or_parser, true);
    QParser_Set_Heed_Colons(and_parser, true);

    // Run logical tests with default boolop of OR.
    for (i = 0; logical_test_funcs[i] != NULL; i++) {
        LUCY_TestQPLogic_Logical_Test_t test_func = logical_test_funcs[i];
        TestQueryParser *test_case_obj = test_func(BOOLOP_OR);
        TestQueryParserIVARS *test_case = TestQP_IVARS(test_case_obj);
        Query *tree     = QParser_Tree(or_parser, test_case->query_string);
        Query *parsed   = QParser_Parse(or_parser, test_case->query_string);
        Hits  *hits     = IxSearcher_Hits(searcher, (Obj*)parsed, 0, 10, NULL);
        char  *qstr     = Str_To_Utf8(test_case->query_string);

        TEST_TRUE(runner, Query_Equals(tree, (Obj*)test_case->tree),
                  "tree() OR   %s", qstr);
        TEST_INT_EQ(runner, Hits_Total_Hits(hits), test_case->num_hits,
                    "hits: OR   %s", qstr);
        free(qstr);
        DECREF(hits);
        DECREF(parsed);
        DECREF(tree);
        DECREF(test_case_obj);
    }

    // Run logical tests with default boolop of AND.
    for (i = 0; logical_test_funcs[i] != NULL; i++) {
        LUCY_TestQPLogic_Logical_Test_t test_func = logical_test_funcs[i];
        TestQueryParser *test_case_obj = test_func(BOOLOP_AND);
        TestQueryParserIVARS *test_case = TestQP_IVARS(test_case_obj);
        Query *tree     = QParser_Tree(and_parser, test_case->query_string);
        Query *parsed   = QParser_Parse(and_parser, test_case->query_string);
        Hits  *hits     = IxSearcher_Hits(searcher, (Obj*)parsed, 0, 10, NULL);
        char  *qstr     = Str_To_Utf8(test_case->query_string);

        TEST_TRUE(runner, Query_Equals(tree, (Obj*)test_case->tree),
                  "tree() AND   %s", qstr);
        TEST_INT_EQ(runner, Hits_Total_Hits(hits), test_case->num_hits,
                    "hits: AND   %s", qstr);
        free(qstr);
        DECREF(hits);
        DECREF(parsed);
        DECREF(tree);
        DECREF(test_case_obj);
    }

    // Run tests for QParser_Prune().
    for (i = 0; prune_test_funcs[i] != NULL; i++) {
        LUCY_TestQPLogic_Prune_Test_t test_func = prune_test_funcs[i];
        TestQueryParser *test_case_obj = test_func();
        TestQueryParserIVARS *test_case = TestQP_IVARS(test_case_obj);
        String *qstring = test_case->tree
                          ? Query_To_String(test_case->tree)
                          : Str_new_from_trusted_utf8("(NULL)", 6);
        char  *qstr = Str_To_Utf8(qstring);
        Query *tree = test_case->tree;
        Query *wanted = test_case->expanded;
        Query *pruned   = QParser_Prune(or_parser, tree);
        Query *expanded;
        Hits  *hits;

        TEST_TRUE(runner, Query_Equals(pruned, (Obj*)wanted),
                  "prune()   %s", qstr);
        expanded = QParser_Expand(or_parser, pruned);
        hits = IxSearcher_Hits(searcher, (Obj*)expanded, 0, 10, NULL);
        TEST_INT_EQ(runner, Hits_Total_Hits(hits), test_case->num_hits,
                    "hits:    %s", qstr);

        free(qstr);
        DECREF(hits);
        DECREF(expanded);
        DECREF(pruned);
        DECREF(qstring);
        DECREF(test_case_obj);
    }

    DECREF(and_parser);
    DECREF(or_parser);
    DECREF(searcher);
    DECREF(folder);
}
示例#29
0
void
TestSegWriter_Run_IMP(TestSegWriter *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 1);
    PASS(runner, "placeholder");
}
示例#30
0
void
TestHeatMap_Run_IMP(TestHeatMap *self, TestBatchRunner *runner) {
    TestBatchRunner_Plan(runner, (TestBatch*)self, 13);
    test_calc_proximity_boost(runner);
    test_flatten_spans(runner);
}