Esempio n. 1
0
static void
test_Dump_Load_and_Equals(TestBatch *batch)
{
    Stemmer *stemmer     = Stemmer_new((CharBuf*)&EN);
    Stemmer *other       = Stemmer_new((CharBuf*)&ES);
    Obj     *dump        = (Obj*)Stemmer_Dump(stemmer);
    Obj     *other_dump  = (Obj*)Stemmer_Dump(other);
    Stemmer *clone       = (Stemmer*)Stemmer_Load(other, dump);
    Stemmer *other_clone = (Stemmer*)Stemmer_Load(other, other_dump);

    ASSERT_FALSE(batch, Stemmer_Equals(stemmer,
        (Obj*)other), "Equals() false with different language");
    ASSERT_TRUE(batch, Stemmer_Dump_Equals(other,
        (Obj*)other_dump), "Dump_Equals()");
    ASSERT_TRUE(batch, Stemmer_Dump_Equals(stemmer,
        (Obj*)dump), "Dump_Equals()");
    ASSERT_FALSE(batch, Stemmer_Dump_Equals(stemmer,
        (Obj*)other_dump), "Dump_Equals() false with different language");
    ASSERT_FALSE(batch, Stemmer_Dump_Equals(other,
        (Obj*)dump), "Dump_Equals() false with different language");
    ASSERT_TRUE(batch, Stemmer_Equals(stemmer,
        (Obj*)clone), "Dump => Load round trip");
    ASSERT_TRUE(batch, Stemmer_Equals(other,
        (Obj*)other_clone), "Dump => Load round trip");

    DECREF(stemmer);
    DECREF(dump);
    DECREF(clone);
    DECREF(other);
    DECREF(other_dump);
    DECREF(other_clone);
}
Esempio n. 2
0
static void
test_Dump_Load_and_Equals(TestBatch *batch)
{
    CharBuf *EN          = (CharBuf*)ZCB_WRAP_STR("en", 2); 
    CharBuf *ES          = (CharBuf*)ZCB_WRAP_STR("es", 2); 
    Stemmer *stemmer     = Stemmer_new(EN);
    Stemmer *other       = Stemmer_new(ES);
    Obj     *dump        = (Obj*)Stemmer_Dump(stemmer);
    Obj     *other_dump  = (Obj*)Stemmer_Dump(other);
    Stemmer *clone       = (Stemmer*)Stemmer_Load(other, dump);
    Stemmer *other_clone = (Stemmer*)Stemmer_Load(other, other_dump);

    TEST_FALSE(batch, Stemmer_Equals(stemmer,
        (Obj*)other), "Equals() false with different language");
    TEST_TRUE(batch, Stemmer_Equals(stemmer,
        (Obj*)clone), "Dump => Load round trip");
    TEST_TRUE(batch, Stemmer_Equals(other,
        (Obj*)other_clone), "Dump => Load round trip");

    DECREF(stemmer);
    DECREF(dump);
    DECREF(clone);
    DECREF(other);
    DECREF(other_dump);
    DECREF(other_clone);
}