You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2013/09/01 22:16:54 UTC
[lucy-commits] [06/24] Rename CharBuf to String (cnick Str)
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Store/SharedLock.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/SharedLock.c b/core/Lucy/Store/SharedLock.c
index 0155417..d9c6c5a 100644
--- a/core/Lucy/Store/SharedLock.c
+++ b/core/Lucy/Store/SharedLock.c
@@ -27,21 +27,21 @@
#include "Lucy/Store/OutStream.h"
SharedLock*
-ShLock_new(Folder *folder, const CharBuf *name, const CharBuf *host,
+ShLock_new(Folder *folder, const String *name, const String *host,
int32_t timeout, int32_t interval) {
SharedLock *self = (SharedLock*)VTable_Make_Obj(SHAREDLOCK);
return ShLock_init(self, folder, name, host, timeout, interval);
}
SharedLock*
-ShLock_init(SharedLock *self, Folder *folder, const CharBuf *name,
- const CharBuf *host, int32_t timeout, int32_t interval) {
+ShLock_init(SharedLock *self, Folder *folder, const String *name,
+ const String *host, int32_t timeout, int32_t interval) {
LFLock_init((LockFileLock*)self, folder, name, host, timeout, interval);
SharedLockIVARS *const ivars = ShLock_IVARS(self);
// Override.
DECREF(ivars->lock_path);
- ivars->lock_path = CB_newf("");
+ ivars->lock_path = Str_newf("");
return self;
}
@@ -61,18 +61,18 @@ ShLock_Request_IMP(SharedLock *self) {
// Empty lock_path indicates whether this particular instance is locked.
if (ivars->lock_path
- && !CB_Equals_Str(ivars->lock_path, "", 0)
+ && !Str_Equals_Str(ivars->lock_path, "", 0)
&& Folder_Exists(ivars->folder, ivars->lock_path)
) {
// Don't allow double obtain.
- Err_set_error((Err*)LockErr_new(CB_newf("Lock already obtained via '%o'",
+ Err_set_error((Err*)LockErr_new(Str_newf("Lock already obtained via '%o'",
ivars->lock_path)));
return false;
}
do {
DECREF(ivars->lock_path);
- ivars->lock_path = CB_newf("locks/%o-%u32.lock", ivars->name, ++i);
+ ivars->lock_path = Str_newf("locks/%o-%u32.lock", ivars->name, ++i);
} while (Folder_Exists(ivars->folder, ivars->lock_path));
bool success = super_request(self);
@@ -83,14 +83,14 @@ ShLock_Request_IMP(SharedLock *self) {
void
ShLock_Release_IMP(SharedLock *self) {
SharedLockIVARS *const ivars = ShLock_IVARS(self);
- if (ivars->lock_path && !CB_Equals_Str(ivars->lock_path, "", 0)) {
+ if (ivars->lock_path && !Str_Equals_Str(ivars->lock_path, "", 0)) {
ShLock_Release_t super_release
= SUPER_METHOD_PTR(SHAREDLOCK, LUCY_ShLock_Release);
super_release(self);
// Empty out lock_path.
DECREF(ivars->lock_path);
- ivars->lock_path = CB_newf("");
+ ivars->lock_path = Str_newf("");
}
}
@@ -99,7 +99,7 @@ void
ShLock_Clear_Stale_IMP(SharedLock *self) {
SharedLockIVARS *const ivars = ShLock_IVARS(self);
- CharBuf *lock_dir_name = (CharBuf*)SSTR_WRAP_STR("locks", 5);
+ String *lock_dir_name = (String*)SSTR_WRAP_STR("locks", 5);
if (!Folder_Find_Folder(ivars->folder, lock_dir_name)) {
return;
}
@@ -109,11 +109,11 @@ ShLock_Clear_Stale_IMP(SharedLock *self) {
// Take a stab at any file that begins with our lock name.
while (DH_Next(dh)) {
- CharBuf *entry = DH_Get_Entry(dh);
- if (CB_Starts_With(entry, ivars->name)
- && CB_Ends_With_Str(entry, ".lock", 5)
+ String *entry = DH_Get_Entry(dh);
+ if (Str_Starts_With(entry, ivars->name)
+ && Str_Ends_With_Str(entry, ".lock", 5)
) {
- CharBuf *candidate = CB_newf("%o/%o", lock_dir_name, entry);
+ String *candidate = Str_newf("%o/%o", lock_dir_name, entry);
ShLock_Maybe_Delete_File(self, candidate, false, true);
DECREF(candidate);
}
@@ -127,7 +127,7 @@ bool
ShLock_Is_Locked_IMP(SharedLock *self) {
SharedLockIVARS *const ivars = ShLock_IVARS(self);
- CharBuf *lock_dir_name = (CharBuf*)SSTR_WRAP_STR("locks", 5);
+ String *lock_dir_name = (String*)SSTR_WRAP_STR("locks", 5);
if (!Folder_Find_Folder(ivars->folder, lock_dir_name)) {
return false;
}
@@ -136,10 +136,10 @@ ShLock_Is_Locked_IMP(SharedLock *self) {
if (!dh) { RETHROW(INCREF(Err_get_error())); }
while (DH_Next(dh)) {
- CharBuf *entry = DH_Get_Entry(dh);
+ String *entry = DH_Get_Entry(dh);
// Translation: $locked = 1 if $entry =~ /^\Q$name-\d+\.lock$/
- if (CB_Starts_With(entry, ivars->name)
- && CB_Ends_With_Str(entry, ".lock", 5)
+ if (Str_Starts_With(entry, ivars->name)
+ && Str_Ends_With_Str(entry, ".lock", 5)
) {
StackString *scratch = SSTR_WRAP(entry);
SStr_Chop(scratch, sizeof(".lock") - 1);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Store/SharedLock.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/SharedLock.cfh b/core/Lucy/Store/SharedLock.cfh
index 0a642b2..ce27042 100644
--- a/core/Lucy/Store/SharedLock.cfh
+++ b/core/Lucy/Store/SharedLock.cfh
@@ -42,7 +42,7 @@ class Lucy::Store::SharedLock cnick ShLock
inherits Lucy::Store::LockFileLock {
inert incremented SharedLock*
- new(Folder *folder, const CharBuf *name, const CharBuf *host,
+ new(Folder *folder, const String *name, const String *host,
int32_t timeout = 0, int32_t interval = 100);
/**
@@ -55,8 +55,8 @@ class Lucy::Store::SharedLock cnick ShLock
* @param interval Time in milliseconds between retries.
*/
public inert SharedLock*
- init(SharedLock *self, Folder *folder, const CharBuf *name,
- const CharBuf *host, int32_t timeout = 0, int32_t interval = 100);
+ init(SharedLock *self, Folder *folder, const String *name,
+ const String *host, int32_t timeout = 0, int32_t interval = 100);
public bool
Shared(SharedLock *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Test/Analysis/TestAnalyzer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestAnalyzer.c b/core/Lucy/Test/Analysis/TestAnalyzer.c
index 41dbb44..a78c023 100644
--- a/core/Lucy/Test/Analysis/TestAnalyzer.c
+++ b/core/Lucy/Test/Analysis/TestAnalyzer.c
@@ -49,9 +49,9 @@ DummyAnalyzer_Transform_IMP(DummyAnalyzer *self, Inversion *inversion) {
static void
test_analysis(TestBatchRunner *runner) {
DummyAnalyzer *analyzer = DummyAnalyzer_new();
- CharBuf *source = CB_newf("foo bar baz");
+ String *source = Str_newf("foo bar baz");
VArray *wanted = VA_new(1);
- VA_Push(wanted, (Obj*)CB_newf("foo bar baz"));
+ VA_Push(wanted, (Obj*)Str_newf("foo bar baz"));
TestUtils_test_analyzer(runner, (Analyzer*)analyzer, source, wanted,
"test basic analysis");
DECREF(wanted);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Test/Analysis/TestCaseFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestCaseFolder.c b/core/Lucy/Test/Analysis/TestCaseFolder.c
index d919047..be032ca 100644
--- a/core/Lucy/Test/Analysis/TestCaseFolder.c
+++ b/core/Lucy/Test/Analysis/TestCaseFolder.c
@@ -51,9 +51,9 @@ test_Dump_Load_and_Equals(TestBatchRunner *runner) {
static void
test_analysis(TestBatchRunner *runner) {
CaseFolder *case_folder = CaseFolder_new();
- CharBuf *source = CB_newf("caPiTal ofFensE");
+ String *source = Str_newf("caPiTal ofFensE");
VArray *wanted = VA_new(1);
- VA_Push(wanted, (Obj*)CB_newf("capital offense"));
+ VA_Push(wanted, (Obj*)Str_newf("capital offense"));
TestUtils_test_analyzer(runner, (Analyzer*)case_folder, source, wanted,
"lowercase plain text");
DECREF(wanted);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Test/Analysis/TestNormalizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestNormalizer.c b/core/Lucy/Test/Analysis/TestNormalizer.c
index 9fdc8fa..0de41ed 100644
--- a/core/Lucy/Test/Analysis/TestNormalizer.c
+++ b/core/Lucy/Test/Analysis/TestNormalizer.c
@@ -38,8 +38,8 @@ static void
test_Dump_Load_and_Equals(TestBatchRunner *runner) {
Normalizer *normalizer[4];
- CharBuf *NFC = (CharBuf*)SSTR_WRAP_STR("NFC", 3);
- CharBuf *NFKC = (CharBuf*)SSTR_WRAP_STR("NFKC", 4);
+ String *NFC = (String*)SSTR_WRAP_STR("NFC", 3);
+ String *NFKC = (String*)SSTR_WRAP_STR("NFKC", 4);
normalizer[0] = Normalizer_new(NFKC, true, false);
normalizer[1] = Normalizer_new(NFC, true, false);
@@ -73,13 +73,13 @@ test_Dump_Load_and_Equals(TestBatchRunner *runner) {
static void
test_normalization(TestBatchRunner *runner) {
FSFolder *modules_folder = TestUtils_modules_folder();
- CharBuf *path = CB_newf("unicode/utf8proc/tests.json");
+ String *path = Str_newf("unicode/utf8proc/tests.json");
VArray *tests = (VArray*)Json_slurp_json((Folder*)modules_folder, path);
if (!tests) { RETHROW(Err_get_error()); }
for (uint32_t i = 0, max = VA_Get_Size(tests); i < max; i++) {
Hash *test = (Hash*)VA_Fetch(tests, i);
- CharBuf *form = (CharBuf*)Hash_Fetch_Str(
+ String *form = (String*)Hash_Fetch_Str(
test, "normalization_form", 18);
bool case_fold = Bool_Get_Value((BoolNum*)Hash_Fetch_Str(
test, "case_fold", 9));
@@ -89,15 +89,15 @@ test_normalization(TestBatchRunner *runner) {
VArray *words = (VArray*)Hash_Fetch_Str(test, "words", 5);
VArray *norms = (VArray*)Hash_Fetch_Str(test, "norms", 5);
for (uint32_t j = 0, max = VA_Get_Size(words); j < max; j++) {
- CharBuf *word = (CharBuf*)VA_Fetch(words, j);
+ String *word = (String*)VA_Fetch(words, j);
VArray *got = Normalizer_Split(normalizer, word);
- CharBuf *norm = (CharBuf*)VA_Fetch(got, 0);
+ String *norm = (String*)VA_Fetch(got, 0);
TEST_TRUE(runner,
norm
- && CB_Is_A(norm, CHARBUF)
- && CB_Equals(norm, VA_Fetch(norms, j)),
- "Normalize %s %d %d: %s", CB_Get_Ptr8(form),
- case_fold, strip_accents, CB_Get_Ptr8(word)
+ && Str_Is_A(norm, STRING)
+ && Str_Equals(norm, VA_Fetch(norms, j)),
+ "Normalize %s %d %d: %s", Str_Get_Ptr8(form),
+ case_fold, strip_accents, Str_Get_Ptr8(word)
);
DECREF(got);
}
@@ -115,11 +115,11 @@ test_utf8proc_normalization(TestBatchRunner *runner) {
return;
for (int32_t i = 0; i < 100; i++) {
- CharBuf *source = TestUtils_random_string(rand() % 40);
+ String *source = TestUtils_random_string(rand() % 40);
// Normalize once.
uint8_t *normalized;
- int32_t check = utf8proc_map(CB_Get_Ptr8(source), CB_Get_Size(source),
+ int32_t check = utf8proc_map(Str_Get_Ptr8(source), Str_Get_Size(source),
&normalized,
UTF8PROC_STABLE |
UTF8PROC_COMPOSE |
@@ -127,11 +127,11 @@ test_utf8proc_normalization(TestBatchRunner *runner) {
UTF8PROC_CASEFOLD);
if (check < 0) {
lucy_Json_set_tolerant(1);
- CharBuf *json = lucy_Json_to_json((Obj*)source);
+ String *json = lucy_Json_to_json((Obj*)source);
if (!json) {
- json = CB_newf("[failed to encode]");
+ json = Str_newf("[failed to encode]");
}
- FAIL(runner, "Failed to normalize: %s", CB_Get_Ptr8(json));
+ FAIL(runner, "Failed to normalize: %s", Str_Get_Ptr8(json));
DECREF(json);
DECREF(source);
return;
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Test/Analysis/TestPolyAnalyzer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestPolyAnalyzer.c b/core/Lucy/Test/Analysis/TestPolyAnalyzer.c
index 56eac3e..79f3b66 100644
--- a/core/Lucy/Test/Analysis/TestPolyAnalyzer.c
+++ b/core/Lucy/Test/Analysis/TestPolyAnalyzer.c
@@ -43,8 +43,8 @@ test_Dump_Load_and_Equals(TestBatchRunner *runner) {
return;
}
- CharBuf *EN = (CharBuf*)SSTR_WRAP_STR("en", 2);
- CharBuf *ES = (CharBuf*)SSTR_WRAP_STR("es", 2);
+ String *EN = (String*)SSTR_WRAP_STR("en", 2);
+ String *ES = (String*)SSTR_WRAP_STR("es", 2);
PolyAnalyzer *analyzer = PolyAnalyzer_new(EN, NULL);
PolyAnalyzer *other = PolyAnalyzer_new(ES, NULL);
Obj *dump = (Obj*)PolyAnalyzer_Dump(analyzer);
@@ -70,8 +70,8 @@ test_Dump_Load_and_Equals(TestBatchRunner *runner) {
static void
test_analysis(TestBatchRunner *runner) {
- CharBuf *EN = (CharBuf*)SSTR_WRAP_STR("en", 2);
- CharBuf *source_text = CB_newf("Eats, shoots and leaves.");
+ String *EN = (String*)SSTR_WRAP_STR("en", 2);
+ String *source_text = Str_newf("Eats, shoots and leaves.");
Normalizer *normalizer = Normalizer_new(NULL, true, false);
StandardTokenizer *tokenizer = StandardTokenizer_new();
SnowballStopFilter *stopfilter = SnowStop_new(EN, NULL);
@@ -94,7 +94,7 @@ test_analysis(TestBatchRunner *runner) {
VA_Push(analyzers, INCREF(normalizer));
PolyAnalyzer *polyanalyzer = PolyAnalyzer_new(NULL, analyzers);
VArray *expected = VA_new(1);
- VA_Push(expected, (Obj*)CB_newf("eats, shoots and leaves."));
+ VA_Push(expected, (Obj*)Str_newf("eats, shoots and leaves."));
TestUtils_test_analyzer(runner, (Analyzer*)polyanalyzer, source_text,
expected, "With Normalizer");
DECREF(expected);
@@ -108,10 +108,10 @@ test_analysis(TestBatchRunner *runner) {
VA_Push(analyzers, INCREF(tokenizer));
PolyAnalyzer *polyanalyzer = PolyAnalyzer_new(NULL, analyzers);
VArray *expected = VA_new(1);
- VA_Push(expected, (Obj*)CB_newf("eats"));
- VA_Push(expected, (Obj*)CB_newf("shoots"));
- VA_Push(expected, (Obj*)CB_newf("and"));
- VA_Push(expected, (Obj*)CB_newf("leaves"));
+ VA_Push(expected, (Obj*)Str_newf("eats"));
+ VA_Push(expected, (Obj*)Str_newf("shoots"));
+ VA_Push(expected, (Obj*)Str_newf("and"));
+ VA_Push(expected, (Obj*)Str_newf("leaves"));
TestUtils_test_analyzer(runner, (Analyzer*)polyanalyzer, source_text,
expected, "With StandardTokenizer");
DECREF(expected);
@@ -126,9 +126,9 @@ test_analysis(TestBatchRunner *runner) {
VA_Push(analyzers, INCREF(stopfilter));
PolyAnalyzer *polyanalyzer = PolyAnalyzer_new(NULL, analyzers);
VArray *expected = VA_new(1);
- VA_Push(expected, (Obj*)CB_newf("eats"));
- VA_Push(expected, (Obj*)CB_newf("shoots"));
- VA_Push(expected, (Obj*)CB_newf("leaves"));
+ VA_Push(expected, (Obj*)Str_newf("eats"));
+ VA_Push(expected, (Obj*)Str_newf("shoots"));
+ VA_Push(expected, (Obj*)Str_newf("leaves"));
TestUtils_test_analyzer(runner, (Analyzer*)polyanalyzer, source_text,
expected, "With SnowballStopFilter");
DECREF(expected);
@@ -144,9 +144,9 @@ test_analysis(TestBatchRunner *runner) {
VA_Push(analyzers, INCREF(stemmer));
PolyAnalyzer *polyanalyzer = PolyAnalyzer_new(NULL, analyzers);
VArray *expected = VA_new(1);
- VA_Push(expected, (Obj*)CB_newf("eat"));
- VA_Push(expected, (Obj*)CB_newf("shoot"));
- VA_Push(expected, (Obj*)CB_newf("leav"));
+ VA_Push(expected, (Obj*)Str_newf("eat"));
+ VA_Push(expected, (Obj*)Str_newf("shoot"));
+ VA_Push(expected, (Obj*)Str_newf("leav"));
TestUtils_test_analyzer(runner, (Analyzer*)polyanalyzer, source_text,
expected, "With SnowballStemmer");
DECREF(expected);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Test/Analysis/TestRegexTokenizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestRegexTokenizer.c b/core/Lucy/Test/Analysis/TestRegexTokenizer.c
index a0e16c9..b0e41b0 100644
--- a/core/Lucy/Test/Analysis/TestRegexTokenizer.c
+++ b/core/Lucy/Test/Analysis/TestRegexTokenizer.c
@@ -41,9 +41,9 @@ test_Dump_Load_and_Equals(TestBatchRunner *runner) {
StackString *word_char_pattern = SSTR_WRAP_STR("\\w+", 3);
StackString *whitespace_pattern = SSTR_WRAP_STR("\\S+", 3);
RegexTokenizer *word_char_tokenizer
- = RegexTokenizer_new((CharBuf*)word_char_pattern);
+ = RegexTokenizer_new((String*)word_char_pattern);
RegexTokenizer *whitespace_tokenizer
- = RegexTokenizer_new((CharBuf*)whitespace_pattern);
+ = RegexTokenizer_new((String*)whitespace_pattern);
Obj *word_char_dump = RegexTokenizer_Dump(word_char_tokenizer);
Obj *whitespace_dump = RegexTokenizer_Dump(whitespace_tokenizer);
RegexTokenizer *word_char_clone
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Test/Analysis/TestSnowballStemmer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestSnowballStemmer.c b/core/Lucy/Test/Analysis/TestSnowballStemmer.c
index 76507bb..572ddae 100644
--- a/core/Lucy/Test/Analysis/TestSnowballStemmer.c
+++ b/core/Lucy/Test/Analysis/TestSnowballStemmer.c
@@ -33,8 +33,8 @@ TestSnowStemmer_new() {
static void
test_Dump_Load_and_Equals(TestBatchRunner *runner) {
- CharBuf *EN = (CharBuf*)SSTR_WRAP_STR("en", 2);
- CharBuf *ES = (CharBuf*)SSTR_WRAP_STR("es", 2);
+ String *EN = (String*)SSTR_WRAP_STR("en", 2);
+ String *ES = (String*)SSTR_WRAP_STR("es", 2);
SnowballStemmer *stemmer = SnowStemmer_new(EN);
SnowballStemmer *other = SnowStemmer_new(ES);
Obj *dump = (Obj*)SnowStemmer_Dump(stemmer);
@@ -63,11 +63,11 @@ test_Dump_Load_and_Equals(TestBatchRunner *runner) {
static void
test_stemming(TestBatchRunner *runner) {
FSFolder *modules_folder = TestUtils_modules_folder();
- CharBuf *path = CB_newf("analysis/snowstem/source/test/tests.json");
+ String *path = Str_newf("analysis/snowstem/source/test/tests.json");
Hash *tests = (Hash*)Json_slurp_json((Folder*)modules_folder, path);
if (!tests) { RETHROW(Err_get_error()); }
- CharBuf *iso;
+ String *iso;
Hash *lang_data;
Hash_Iterate(tests);
while (Hash_Next(tests, (Obj**)&iso, (Obj**)&lang_data)) {
@@ -75,14 +75,14 @@ test_stemming(TestBatchRunner *runner) {
VArray *stems = (VArray*)Hash_Fetch_Str(lang_data, "stems", 5);
SnowballStemmer *stemmer = SnowStemmer_new(iso);
for (uint32_t i = 0, max = VA_Get_Size(words); i < max; i++) {
- CharBuf *word = (CharBuf*)VA_Fetch(words, i);
+ String *word = (String*)VA_Fetch(words, i);
VArray *got = SnowStemmer_Split(stemmer, word);
- CharBuf *stem = (CharBuf*)VA_Fetch(got, 0);
+ String *stem = (String*)VA_Fetch(got, 0);
TEST_TRUE(runner,
stem
- && CB_Is_A(stem, CHARBUF)
- && CB_Equals(stem, VA_Fetch(stems, i)),
- "Stem %s: %s", CB_Get_Ptr8(iso), CB_Get_Ptr8(word)
+ && Str_Is_A(stem, STRING)
+ && Str_Equals(stem, VA_Fetch(stems, i)),
+ "Stem %s: %s", Str_Get_Ptr8(iso), Str_Get_Ptr8(word)
);
DECREF(got);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Test/Analysis/TestSnowballStopFilter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestSnowballStopFilter.c b/core/Lucy/Test/Analysis/TestSnowballStopFilter.c
index 1cf57ab..46f4cd5 100644
--- a/core/Lucy/Test/Analysis/TestSnowballStopFilter.c
+++ b/core/Lucy/Test/Analysis/TestSnowballStopFilter.c
@@ -38,7 +38,7 @@ S_make_stopfilter(void *unused, ...) {
va_start(args, unused);
while (NULL != (stopword = va_arg(args, char*))) {
Hash_Store_Str(stoplist, stopword, strlen(stopword),
- (Obj*)CB_newf(""));
+ (Obj*)Str_newf(""));
}
va_end(args);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Test/Analysis/TestStandardTokenizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestStandardTokenizer.c b/core/Lucy/Test/Analysis/TestStandardTokenizer.c
index 90d1318..837cb58 100644
--- a/core/Lucy/Test/Analysis/TestStandardTokenizer.c
+++ b/core/Lucy/Test/Analysis/TestStandardTokenizer.c
@@ -61,47 +61,47 @@ test_tokenizer(TestBatchRunner *runner) {
"a"
"/",
35);
- VArray *got = StandardTokenizer_Split(tokenizer, (CharBuf*)word);
- CharBuf *token = (CharBuf*)VA_Fetch(got, 0);
+ VArray *got = StandardTokenizer_Split(tokenizer, (String*)word);
+ String *token = (String*)VA_Fetch(got, 0);
TEST_TRUE(runner,
token
- && CB_Is_A(token, CHARBUF)
- && CB_Equals_Str(token, "tha\xcc\x82t's", 8),
- "Token: %s", CB_Get_Ptr8(token));
- token = (CharBuf*)VA_Fetch(got, 1);
+ && Str_Is_A(token, STRING)
+ && Str_Equals_Str(token, "tha\xcc\x82t's", 8),
+ "Token: %s", Str_Get_Ptr8(token));
+ token = (String*)VA_Fetch(got, 1);
TEST_TRUE(runner,
token
- && CB_Is_A(token, CHARBUF)
- && CB_Equals_Str(token, "1,02\xC2\xADZ4.38", 11),
- "Token: %s", CB_Get_Ptr8(token));
- token = (CharBuf*)VA_Fetch(got, 2);
+ && Str_Is_A(token, STRING)
+ && Str_Equals_Str(token, "1,02\xC2\xADZ4.38", 11),
+ "Token: %s", Str_Get_Ptr8(token));
+ token = (String*)VA_Fetch(got, 2);
TEST_TRUE(runner,
token
- && CB_Is_A(token, CHARBUF)
- && CB_Equals_Str(token, "\xE0\xB8\x81\xC2\xAD\xC2\xAD", 7),
- "Token: %s", CB_Get_Ptr8(token));
- token = (CharBuf*)VA_Fetch(got, 3);
+ && Str_Is_A(token, STRING)
+ && Str_Equals_Str(token, "\xE0\xB8\x81\xC2\xAD\xC2\xAD", 7),
+ "Token: %s", Str_Get_Ptr8(token));
+ token = (String*)VA_Fetch(got, 3);
TEST_TRUE(runner,
token
- && CB_Is_A(token, CHARBUF)
- && CB_Equals_Str(token, "\xF0\xA0\x80\x80", 4),
- "Token: %s", CB_Get_Ptr8(token));
- token = (CharBuf*)VA_Fetch(got, 4);
+ && Str_Is_A(token, STRING)
+ && Str_Equals_Str(token, "\xF0\xA0\x80\x80", 4),
+ "Token: %s", Str_Get_Ptr8(token));
+ token = (String*)VA_Fetch(got, 4);
TEST_TRUE(runner,
token
- && CB_Is_A(token, CHARBUF)
- && CB_Equals_Str(token, "a", 1),
- "Token: %s", CB_Get_Ptr8(token));
+ && Str_Is_A(token, STRING)
+ && Str_Equals_Str(token, "a", 1),
+ "Token: %s", Str_Get_Ptr8(token));
DECREF(got);
FSFolder *modules_folder = TestUtils_modules_folder();
- CharBuf *path = CB_newf("unicode/ucd/WordBreakTest.json");
+ String *path = Str_newf("unicode/ucd/WordBreakTest.json");
VArray *tests = (VArray*)Json_slurp_json((Folder*)modules_folder, path);
if (!tests) { RETHROW(Err_get_error()); }
for (uint32_t i = 0, max = VA_Get_Size(tests); i < max; i++) {
Hash *test = (Hash*)VA_Fetch(tests, i);
- CharBuf *text = (CharBuf*)Hash_Fetch_Str(test, "text", 4);
+ String *text = (String*)Hash_Fetch_Str(test, "text", 4);
VArray *wanted = (VArray*)Hash_Fetch_Str(test, "words", 5);
VArray *got = StandardTokenizer_Split(tokenizer, text);
TEST_TRUE(runner, VA_Equals(wanted, (Obj*)got), "UCD test #%d", i + 1);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Test/Highlight/TestHighlighter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Highlight/TestHighlighter.c b/core/Lucy/Test/Highlight/TestHighlighter.c
index 149247e..1128e84 100644
--- a/core/Lucy/Test/Highlight/TestHighlighter.c
+++ b/core/Lucy/Test/Highlight/TestHighlighter.c
@@ -59,7 +59,7 @@ TestHighlighter_new() {
static void
test_Find_Best_Fragment(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
- CharBuf *content = (CharBuf*)SSTR_WRAP_STR("content", 7);
+ String *content = (String*)SSTR_WRAP_STR("content", 7);
Highlighter *highlighter = Highlighter_new(searcher, query, content, 3);
ViewCharBuf *target = (ViewCharBuf*)SStr_BLANK();
@@ -67,20 +67,20 @@ test_Find_Best_Fragment(TestBatchRunner *runner, Searcher *searcher, Obj *query)
VA_Push(spans, (Obj*)Span_new(2, 1, 1.0f));
HeatMap *heat_map = HeatMap_new(spans, 133);
DECREF(spans);
- CharBuf *field_val = (CharBuf *)SSTR_WRAP_STR("a " PHI " " PHI " b c", 11);
+ String *field_val = (String *)SSTR_WRAP_STR("a " PHI " " PHI " b c", 11);
int32_t top = Highlighter_Find_Best_Fragment(highlighter, field_val,
target, heat_map);
TEST_TRUE(runner,
- CB_Equals_Str((CharBuf *)target, PHI " " PHI " b", 7),
+ Str_Equals_Str((String *)target, PHI " " PHI " b", 7),
"Find_Best_Fragment");
TEST_TRUE(runner,
top == 2,
"correct offset returned by Find_Best_Fragment");
- field_val = (CharBuf *)SSTR_WRAP_STR("aa" PHI, 4);
+ field_val = (String *)SSTR_WRAP_STR("aa" PHI, 4);
top = Highlighter_Find_Best_Fragment(highlighter, field_val,
target, heat_map);
TEST_TRUE(runner,
- CB_Equals_Str((CharBuf *)target, "aa" PHI, 4),
+ Str_Equals_Str((String *)target, "aa" PHI, 4),
"Find_Best_Fragment returns whole field when field is short");
TEST_TRUE(runner,
top == 0,
@@ -91,11 +91,11 @@ test_Find_Best_Fragment(TestBatchRunner *runner, Searcher *searcher, Obj *query)
VA_Push(spans, (Obj*)Span_new(6, 2, 1.0f));
heat_map = HeatMap_new(spans, 133);
DECREF(spans);
- field_val = (CharBuf *)SSTR_WRAP_STR("aaaab" PHI PHI, 9);
+ field_val = (String *)SSTR_WRAP_STR("aaaab" PHI PHI, 9);
top = Highlighter_Find_Best_Fragment(highlighter, field_val,
target, heat_map);
TEST_TRUE(runner,
- CB_Equals_Str((CharBuf *)target, "b" PHI PHI, 5),
+ Str_Equals_Str((String *)target, "b" PHI PHI, 5),
"Find_Best_Fragment shifts left to deal with overrun");
TEST_TRUE(runner,
top == 4,
@@ -106,11 +106,11 @@ test_Find_Best_Fragment(TestBatchRunner *runner, Searcher *searcher, Obj *query)
VA_Push(spans, (Obj*)Span_new(0, 1, 1.0f));
heat_map = HeatMap_new(spans, 133);
DECREF(spans);
- field_val = (CharBuf *)SSTR_WRAP_STR("a" PHI "bcde", 7);
+ field_val = (String *)SSTR_WRAP_STR("a" PHI "bcde", 7);
top = Highlighter_Find_Best_Fragment(highlighter, field_val,
target, heat_map);
TEST_TRUE(runner,
- CB_Equals_Str((CharBuf *)target, "a" PHI "bcd", 6),
+ Str_Equals_Str((String *)target, "a" PHI "bcd", 6),
"Find_Best_Fragment start at field beginning");
TEST_TRUE(runner,
top == 0,
@@ -122,12 +122,12 @@ test_Find_Best_Fragment(TestBatchRunner *runner, Searcher *searcher, Obj *query)
static void
test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
- CharBuf *content = (CharBuf*)SSTR_WRAP_STR("content", 7);
+ String *content = (String*)SSTR_WRAP_STR("content", 7);
Highlighter *highlighter = Highlighter_new(searcher, query, content, 6);
- CharBuf *field_val = (CharBuf *)SSTR_WRAP_STR("Ook. Urk. Ick. ", 18);
- CharBuf *fragment = (CharBuf *)SSTR_WRAP_STR("Ook. Urk.", 10);
- CharBuf *raw_excerpt = CB_new(0);
+ String *field_val = (String *)SSTR_WRAP_STR("Ook. Urk. Ick. ", 18);
+ String *fragment = (String *)SSTR_WRAP_STR("Ook. Urk.", 10);
+ String *raw_excerpt = Str_new(0);
VArray *spans = VA_new(1);
VA_Push(spans, (Obj*)Span_new(0, 18, 1.0f));
HeatMap *heat_map = HeatMap_new(spans, 133);
@@ -138,7 +138,7 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
int32_t top = Highlighter_Raw_Excerpt(highlighter, field_val, fragment,
raw_excerpt, 0, heat_map, sentences);
TEST_TRUE(runner,
- CB_Equals_Str(raw_excerpt, "Ook.", 4),
+ Str_Equals_Str(raw_excerpt, "Ook.", 4),
"Raw_Excerpt at top");
TEST_TRUE(runner,
top == 0,
@@ -146,15 +146,15 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
DECREF(sentences);
DECREF(raw_excerpt);
- fragment = (CharBuf *)SSTR_WRAP_STR(". Urk. I", 10);
- raw_excerpt = CB_new(0);
+ fragment = (String *)SSTR_WRAP_STR(". Urk. I", 10);
+ raw_excerpt = Str_new(0);
sentences = VA_new(2);
VA_Push(sentences, (Obj*)Span_new(6, 4, 0.0f));
VA_Push(sentences, (Obj*)Span_new(12, 4, 0.0f));
top = Highlighter_Raw_Excerpt(highlighter, field_val, fragment,
raw_excerpt, 3, heat_map, sentences);
TEST_TRUE(runner,
- CB_Equals_Str(raw_excerpt, "Urk.", 4),
+ Str_Equals_Str(raw_excerpt, "Urk.", 4),
"Raw_Excerpt in middle, with 2 bounds");
TEST_TRUE(runner,
top == 6,
@@ -163,9 +163,9 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
DECREF(heat_map);
DECREF(raw_excerpt);
- field_val = (CharBuf *)SSTR_WRAP_STR("Ook urk ick i.", 14);
- fragment = (CharBuf *)SSTR_WRAP_STR("ick i.", 6);
- raw_excerpt = CB_new(0);
+ field_val = (String *)SSTR_WRAP_STR("Ook urk ick i.", 14);
+ fragment = (String *)SSTR_WRAP_STR("ick i.", 6);
+ raw_excerpt = Str_new(0);
spans = VA_new(1);
VA_Push(spans, (Obj*)Span_new(0, 14, 1.0f));
heat_map = HeatMap_new(spans, 133);
@@ -175,7 +175,7 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
top = Highlighter_Raw_Excerpt(highlighter, field_val, fragment,
raw_excerpt, 8, heat_map, sentences);
TEST_TRUE(runner,
- CB_Equals_Str(raw_excerpt, ELLIPSIS " i.", 6),
+ Str_Equals_Str(raw_excerpt, ELLIPSIS " i.", 6),
"Ellipsis at top");
TEST_TRUE(runner,
top == 10,
@@ -184,9 +184,9 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
DECREF(heat_map);
DECREF(raw_excerpt);
- field_val = (CharBuf *)SSTR_WRAP_STR("Urk. Iz no good.", 17);
- fragment = (CharBuf *)SSTR_WRAP_STR(" Iz no go", 10);
- raw_excerpt = CB_new(0);
+ field_val = (String *)SSTR_WRAP_STR("Urk. Iz no good.", 17);
+ fragment = (String *)SSTR_WRAP_STR(" Iz no go", 10);
+ raw_excerpt = Str_new(0);
spans = VA_new(1);
VA_Push(spans, (Obj*)Span_new(0, 17, 1.0f));
heat_map = HeatMap_new(spans, 133);
@@ -196,7 +196,7 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
top = Highlighter_Raw_Excerpt(highlighter, field_val, fragment,
raw_excerpt, 4, heat_map, sentences);
TEST_TRUE(runner,
- CB_Equals_Str(raw_excerpt, "Iz no" ELLIPSIS, 8),
+ Str_Equals_Str(raw_excerpt, "Iz no" ELLIPSIS, 8),
"Ellipsis at end");
TEST_TRUE(runner,
top == 6,
@@ -207,11 +207,11 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
// Words longer than excerpt len
- field_val = (CharBuf *)SSTR_WRAP_STR("abc/def/ghi/jkl/mno", 19);
+ field_val = (String *)SSTR_WRAP_STR("abc/def/ghi/jkl/mno", 19);
sentences = VA_new(1);
VA_Push(sentences, (Obj*)Span_new(0, 19, 0.0f));
- raw_excerpt = CB_new(0);
+ raw_excerpt = Str_new(0);
spans = VA_new(1);
VA_Push(spans, (Obj*)Span_new(0, 3, 1.0f));
heat_map = HeatMap_new(spans, 133);
@@ -219,12 +219,12 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
top = Highlighter_Raw_Excerpt(highlighter, field_val, field_val,
raw_excerpt, 0, heat_map, sentences);
TEST_TRUE(runner,
- CB_Equals_Str(raw_excerpt, "abc/d" ELLIPSIS, 8),
+ Str_Equals_Str(raw_excerpt, "abc/d" ELLIPSIS, 8),
"Long word");
DECREF(heat_map);
DECREF(raw_excerpt);
- raw_excerpt = CB_new(0);
+ raw_excerpt = Str_new(0);
spans = VA_new(1);
VA_Push(spans, (Obj*)Span_new(8, 3, 1.0f));
heat_map = HeatMap_new(spans, 133);
@@ -232,7 +232,7 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
top = Highlighter_Raw_Excerpt(highlighter, field_val, field_val,
raw_excerpt, 0, heat_map, sentences);
TEST_TRUE(runner,
- CB_Equals_Str(raw_excerpt, ELLIPSIS " c/d" ELLIPSIS, 10),
+ Str_Equals_Str(raw_excerpt, ELLIPSIS " c/d" ELLIPSIS, 10),
"Long word");
DECREF(heat_map);
DECREF(raw_excerpt);
@@ -244,17 +244,17 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
static void
test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
- CharBuf *content = (CharBuf*)SSTR_WRAP_STR("content", 7);
+ String *content = (String*)SSTR_WRAP_STR("content", 7);
Highlighter *highlighter = Highlighter_new(searcher, query, content, 3);
VArray *spans = VA_new(1);
VA_Push(spans, (Obj*)Span_new(2, 1, 0.0f));
- CharBuf *raw_excerpt = (CharBuf *)SSTR_WRAP_STR("a b c", 5);
- CharBuf *highlighted = CB_new(0);
+ String *raw_excerpt = (String *)SSTR_WRAP_STR("a b c", 5);
+ String *highlighted = Str_new(0);
Highlighter_Highlight_Excerpt(highlighter, spans, raw_excerpt,
highlighted, 0);
TEST_TRUE(runner,
- CB_Equals_Str(highlighted, "a <strong>b</strong> c", 22),
+ Str_Equals_Str(highlighted, "a <strong>b</strong> c", 22),
"basic Highlight_Excerpt");
DECREF(highlighted);
DECREF(spans);
@@ -262,24 +262,24 @@ test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query)
spans = VA_new(2);
VA_Push(spans, (Obj*)Span_new(0, 1, 1.0f));
VA_Push(spans, (Obj*)Span_new(10, 10, 1.0f));
- raw_excerpt = (CharBuf *)SSTR_WRAP_STR(PHI, 2);
- highlighted = CB_new(0);
+ raw_excerpt = (String *)SSTR_WRAP_STR(PHI, 2);
+ highlighted = Str_new(0);
Highlighter_Highlight_Excerpt(highlighter, spans, raw_excerpt,
highlighted, 0);
TEST_TRUE(runner,
- CB_Equals_Str(highlighted, "<strong>Φ</strong>", 23),
+ Str_Equals_Str(highlighted, "<strong>Φ</strong>", 23),
"don't surround spans off end of raw excerpt.");
DECREF(highlighted);
DECREF(spans);
spans = VA_new(1);
VA_Push(spans, (Obj*)Span_new(3, 1, 1.0f));
- raw_excerpt = (CharBuf *)SSTR_WRAP_STR(PHI " " PHI " " PHI, 8);
- highlighted = CB_new(0);
+ raw_excerpt = (String *)SSTR_WRAP_STR(PHI " " PHI " " PHI, 8);
+ highlighted = Str_new(0);
Highlighter_Highlight_Excerpt(highlighter, spans, raw_excerpt,
highlighted, 1);
TEST_TRUE(runner,
- CB_Equals_Str(highlighted,
+ Str_Equals_Str(highlighted,
"Φ <strong>Φ</strong> Φ", 37),
"Highlight_Excerpt pays attention to offset");
DECREF(highlighted);
@@ -290,12 +290,12 @@ test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query)
VA_Push(spans, (Obj*)Span_new(2, 4, 1.0f));
VA_Push(spans, (Obj*)Span_new(8, 9, 1.0f));
VA_Push(spans, (Obj*)Span_new(8, 4, 1.0f));
- raw_excerpt = (CharBuf *)SSTR_WRAP_STR(PHI " Oook. Urk. Ick. " PHI, 21);
- highlighted = CB_new(0);
+ raw_excerpt = (String *)SSTR_WRAP_STR(PHI " Oook. Urk. Ick. " PHI, 21);
+ highlighted = Str_new(0);
Highlighter_Highlight_Excerpt(highlighter, spans, raw_excerpt,
highlighted, 0);
TEST_TRUE(runner,
- CB_Equals_Str(highlighted,
+ Str_Equals_Str(highlighted,
"Φ <strong>Oook. Urk. Ick.</strong> Φ",
46),
"Highlight_Excerpt works with overlapping spans");
@@ -308,25 +308,25 @@ test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query)
static void
test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
Hits *hits) {
- CharBuf *content = (CharBuf*)SSTR_WRAP_STR("content", 7);
+ String *content = (String*)SSTR_WRAP_STR("content", 7);
Highlighter *highlighter = Highlighter_new(searcher, query, content, 200);
HitDoc *hit = Hits_Next(hits);
- CharBuf *excerpt = Highlighter_Create_Excerpt(highlighter, hit);
+ String *excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
- CB_Find_Str(excerpt,
+ Str_Find_Str(excerpt,
"<strong>Φ</strong> a b c d <strong>x y z</strong>",
54) >= 0,
"highlighter tagged phrase and single term");
DECREF(excerpt);
- CharBuf *pre_tag = (CharBuf*)SSTR_WRAP_STR("\x1B[1m", 4);
+ String *pre_tag = (String*)SSTR_WRAP_STR("\x1B[1m", 4);
Highlighter_Set_Pre_Tag(highlighter, pre_tag);
- CharBuf *post_tag = (CharBuf*)SSTR_WRAP_STR("\x1B[0m", 4);
+ String *post_tag = (String*)SSTR_WRAP_STR("\x1B[0m", 4);
Highlighter_Set_Post_Tag(highlighter, post_tag);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
- CB_Find_Str(excerpt,
+ Str_Find_Str(excerpt,
"\x1B[1mΦ\x1B[0m a b c d \x1B[1mx y z\x1B[0m",
36) >= 0,
"set_pre_tag and set_post_tag");
@@ -336,7 +336,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
hit = Hits_Next(hits);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
- CB_Find_Str(excerpt, "x", 1) >= 0,
+ Str_Find_Str(excerpt, "x", 1) >= 0,
"excerpt field with partial hit doesn't cause highlighter freakout");
DECREF(excerpt);
DECREF(hit);
@@ -348,7 +348,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
hit = Hits_Next(hits);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
- CB_Find_Str(excerpt,
+ Str_Find_Str(excerpt,
"<strong>b</strong> c d <strong>x y z</strong>",
45) >= 0,
"query with same word in both phrase and term doesn't cause freakout");
@@ -363,7 +363,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
hit = Hits_Next(hits);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
- CB_Find_Str(excerpt, """, 6) >= 0,
+ Str_Find_Str(excerpt, """, 6) >= 0,
"HTML entity encoded properly");
DECREF(excerpt);
DECREF(hit);
@@ -376,7 +376,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
hit = Hits_Next(hits);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
- CB_Find_Str(excerpt, "Φ", 6) == -1,
+ Str_Find_Str(excerpt, "Φ", 6) == -1,
"no ellipsis for short excerpt");
DECREF(excerpt);
DECREF(hit);
@@ -390,15 +390,15 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
highlighter = Highlighter_new(searcher, query, content, 200);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
- CB_Find_Str(excerpt, "strong", 5) >= 0,
+ Str_Find_Str(excerpt, "strong", 5) >= 0,
"specify field highlights correct field...");
DECREF(excerpt);
DECREF(highlighter);
- CharBuf *alt = (CharBuf*)SSTR_WRAP_STR("alt", 3);
+ String *alt = (String*)SSTR_WRAP_STR("alt", 3);
highlighter = Highlighter_new(searcher, query, alt, 200);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
- CB_Find_Str(excerpt, "strong", 5) == -1,
+ Str_Find_Str(excerpt, "strong", 5) == -1,
"... but not another field");
DECREF(excerpt);
DECREF(highlighter);
@@ -409,9 +409,9 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
static void
test_Find_Sentences(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
- CharBuf *content = (CharBuf*)SSTR_WRAP_STR("content", 7);
+ String *content = (String*)SSTR_WRAP_STR("content", 7);
Highlighter *highlighter = Highlighter_new(searcher, query, content, 200);
- CharBuf *text = (CharBuf*)SSTR_WRAP_STR(
+ String *text = (String*)SSTR_WRAP_STR(
"This is a sentence. This is a sentence. This is a sentence. "
"This is a sentence. This is a sentence. This is a sentence. "
"This is a sentence. This is a sentence. This is a sentence. "
@@ -446,7 +446,7 @@ test_Find_Sentences(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
DECREF(wanted);
DECREF(got);
- text = (CharBuf*)SSTR_WRAP_STR(" Foo", 4);
+ text = (String*)SSTR_WRAP_STR(" Foo", 4);
got = Highlighter_Find_Sentences(highlighter, text, 0, 0);
wanted = VA_new(1);
VA_Push(wanted, (Obj*)Span_new(1, 3, 0.0f));
@@ -468,9 +468,9 @@ test_highlighting(TestBatchRunner *runner) {
FullTextType *dunked_type = FullTextType_new((Analyzer*)tokenizer);
FullTextType_Set_Highlightable(dunked_type, true);
FullTextType_Set_Boost(dunked_type, 0.1f);
- CharBuf *content = (CharBuf*)SSTR_WRAP_STR("content", 7);
+ String *content = (String*)SSTR_WRAP_STR("content", 7);
Schema_Spec_Field(schema, content, (FieldType*)plain_type);
- CharBuf *alt = (CharBuf*)SSTR_WRAP_STR("alt", 3);
+ String *alt = (String*)SSTR_WRAP_STR("alt", 3);
Schema_Spec_Field(schema, alt, (FieldType*)dunked_type);
DECREF(plain_type);
DECREF(dunked_type);
@@ -480,21 +480,21 @@ test_highlighting(TestBatchRunner *runner) {
Indexer *indexer = Indexer_new(schema, (Obj*)folder, NULL, 0);
Doc *doc = Doc_new(NULL, 0);
- CharBuf *string = (CharBuf *)SSTR_WRAP_STR(TEST_STRING, TEST_STRING_LEN);
+ String *string = (String *)SSTR_WRAP_STR(TEST_STRING, TEST_STRING_LEN);
Doc_Store(doc, content, (Obj*)string);
Indexer_Add_Doc(indexer, doc, 1.0f);
DECREF(doc);
doc = Doc_new(NULL, 0);
- string = (CharBuf *)SSTR_WRAP_STR("\"I see,\" said the blind man.", 28);
+ string = (String *)SSTR_WRAP_STR("\"I see,\" said the blind man.", 28);
Doc_Store(doc, content, (Obj*)string);
Indexer_Add_Doc(indexer, doc, 1.0f);
DECREF(doc);
doc = Doc_new(NULL, 0);
- string = (CharBuf *)SSTR_WRAP_STR("x but not why or 2ee", 20);
+ string = (String *)SSTR_WRAP_STR("x but not why or 2ee", 20);
Doc_Store(doc, content, (Obj*)string);
- string = (CharBuf *)SSTR_WRAP_STR(TEST_STRING
+ string = (String *)SSTR_WRAP_STR(TEST_STRING
" and extra stuff so it scores lower",
TEST_STRING_LEN + 35);
Doc_Store(doc, alt, (Obj*)string);
@@ -526,7 +526,7 @@ test_hl_selection(TestBatchRunner *runner) {
StandardTokenizer *tokenizer = StandardTokenizer_new();
FullTextType *plain_type = FullTextType_new((Analyzer*)tokenizer);
FullTextType_Set_Highlightable(plain_type, true);
- CharBuf *content = (CharBuf*)SSTR_WRAP_STR("content", 7);
+ String *content = (String*)SSTR_WRAP_STR("content", 7);
Schema_Spec_Field(schema, content, (FieldType*)plain_type);
DECREF(plain_type);
DECREF(tokenizer);
@@ -549,7 +549,7 @@ test_hl_selection(TestBatchRunner *runner) {
"bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla. "
"bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla. ";
Doc *doc = Doc_new(NULL, 0);
- CharBuf *string = (CharBuf *)SSTR_WRAP_STR(test_string, strlen(test_string));
+ String *string = (String *)SSTR_WRAP_STR(test_string, strlen(test_string));
Doc_Store(doc, content, (Obj*)string);
Indexer_Add_Doc(indexer, doc, 1.0f);
DECREF(doc);
@@ -562,10 +562,10 @@ test_hl_selection(TestBatchRunner *runner) {
Highlighter *highlighter = Highlighter_new(searcher, query, content, 200);
Hits *hits = Searcher_Hits(searcher, query, 0, 10, NULL);
HitDoc *hit = Hits_Next(hits);
- CharBuf *excerpt = Highlighter_Create_Excerpt(highlighter, hit);
- CharBuf *mmm = (CharBuf*)SSTR_WRAP_STR("MMM", 3);
- CharBuf *nnn = (CharBuf*)SSTR_WRAP_STR("NNN", 3);
- TEST_TRUE(runner, CB_Find(excerpt, mmm) >= 0 || CB_Find(excerpt, nnn) >= 0,
+ String *excerpt = Highlighter_Create_Excerpt(highlighter, hit);
+ String *mmm = (String*)SSTR_WRAP_STR("MMM", 3);
+ String *nnn = (String*)SSTR_WRAP_STR("NNN", 3);
+ TEST_TRUE(runner, Str_Find(excerpt, mmm) >= 0 || Str_Find(excerpt, nnn) >= 0,
"Sentence boundary algo doesn't chop terms");
DECREF(excerpt);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Test/Index/TestSegment.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Index/TestSegment.c b/core/Lucy/Test/Index/TestSegment.c
index 54f0745..bd83256 100644
--- a/core/Lucy/Test/Index/TestSegment.c
+++ b/core/Lucy/Test/Index/TestSegment.c
@@ -37,12 +37,12 @@ test_fields(TestBatchRunner *runner) {
StackString *baz = SSTR_WRAP_STR("baz", 3);
int32_t field_num;
- field_num = Seg_Add_Field(segment, (CharBuf*)foo);
+ field_num = Seg_Add_Field(segment, (String*)foo);
TEST_TRUE(runner, field_num == 1,
"Add_Field returns field number, and field numbers start at 1");
- field_num = Seg_Add_Field(segment, (CharBuf*)bar);
+ field_num = Seg_Add_Field(segment, (String*)bar);
TEST_TRUE(runner, field_num == 2, "add a second field");
- field_num = Seg_Add_Field(segment, (CharBuf*)foo);
+ field_num = Seg_Add_Field(segment, (String*)foo);
TEST_TRUE(runner, field_num == 1,
"Add_Field returns existing field number if field is already known");
@@ -50,9 +50,9 @@ test_fields(TestBatchRunner *runner) {
"Field_Name");
TEST_TRUE(runner, Seg_Field_Name(segment, 3) == NULL,
"Field_Name returns NULL for unknown field number");
- TEST_TRUE(runner, Seg_Field_Num(segment, (CharBuf*)bar) == 2,
+ TEST_TRUE(runner, Seg_Field_Num(segment, (String*)bar) == 2,
"Field_Num");
- TEST_TRUE(runner, Seg_Field_Num(segment, (CharBuf*)baz) == 0,
+ TEST_TRUE(runner, Seg_Field_Num(segment, (String*)baz) == 0,
"Field_Num returns 0 for unknown field name");
DECREF(segment);
@@ -61,14 +61,14 @@ test_fields(TestBatchRunner *runner) {
static void
test_metadata_storage(TestBatchRunner *runner) {
Segment *segment = Seg_new(1);
- CharBuf *got;
+ String *got;
- Seg_Store_Metadata_Str(segment, "foo", 3, (Obj*)CB_newf("bar"));
- got = (CharBuf*)Seg_Fetch_Metadata_Str(segment, "foo", 3);
+ Seg_Store_Metadata_Str(segment, "foo", 3, (Obj*)Str_newf("bar"));
+ got = (String*)Seg_Fetch_Metadata_Str(segment, "foo", 3);
TEST_TRUE(runner,
got
- && CB_Is_A(got, CHARBUF)
- && CB_Equals_Str(got, "bar", 3),
+ && Str_Is_A(got, STRING)
+ && Str_Equals_Str(got, "bar", 3),
"metadata round trip"
);
DECREF(segment);
@@ -77,11 +77,11 @@ test_metadata_storage(TestBatchRunner *runner) {
static void
test_seg_name_and_num(TestBatchRunner *runner) {
Segment *segment_z = Seg_new(35);
- CharBuf *seg_z_name = Seg_num_to_name(35);
+ String *seg_z_name = Seg_num_to_name(35);
TEST_TRUE(runner, Seg_Get_Number(segment_z) == INT64_C(35), "Get_Number");
- TEST_TRUE(runner, CB_Equals_Str(Seg_Get_Name(segment_z), "seg_z", 5),
+ TEST_TRUE(runner, Str_Equals_Str(Seg_Get_Name(segment_z), "seg_z", 5),
"Get_Name");
- TEST_TRUE(runner, CB_Equals_Str(seg_z_name, "seg_z", 5),
+ TEST_TRUE(runner, Str_Equals_Str(seg_z_name, "seg_z", 5),
"num_to_name");
DECREF(seg_z_name);
DECREF(segment_z);
@@ -125,12 +125,12 @@ test_Write_File_and_Read_File(TestBatchRunner *runner) {
RAMFolder *folder = RAMFolder_new(NULL);
Segment *segment = Seg_new(100);
Segment *got = Seg_new(100);
- CharBuf *meta;
- CharBuf *flotsam = (CharBuf*)SSTR_WRAP_STR("flotsam", 7);
- CharBuf *jetsam = (CharBuf*)SSTR_WRAP_STR("jetsam", 6);
+ String *meta;
+ String *flotsam = (String*)SSTR_WRAP_STR("flotsam", 7);
+ String *jetsam = (String*)SSTR_WRAP_STR("jetsam", 6);
Seg_Set_Count(segment, 111);
- Seg_Store_Metadata_Str(segment, "foo", 3, (Obj*)CB_newf("bar"));
+ Seg_Store_Metadata_Str(segment, "foo", 3, (Obj*)Str_newf("bar"));
Seg_Add_Field(segment, flotsam);
Seg_Add_Field(segment, jetsam);
@@ -143,11 +143,11 @@ test_Write_File_and_Read_File(TestBatchRunner *runner) {
TEST_TRUE(runner,
Seg_Field_Num(got, jetsam) == Seg_Field_Num(segment, jetsam),
"Round trip field names through file");
- meta = (CharBuf*)Seg_Fetch_Metadata_Str(got, "foo", 3);
+ meta = (String*)Seg_Fetch_Metadata_Str(got, "foo", 3);
TEST_TRUE(runner,
meta
- && CB_Is_A(meta, CHARBUF)
- && CB_Equals_Str(meta, "bar", 3),
+ && Str_Is_A(meta, STRING)
+ && Str_Equals_Str(meta, "bar", 3),
"Round trip metadata through file");
DECREF(got);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Test/Index/TestSnapshot.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Index/TestSnapshot.c b/core/Lucy/Test/Index/TestSnapshot.c
index b281c73..1367d87 100644
--- a/core/Lucy/Test/Index/TestSnapshot.c
+++ b/core/Lucy/Test/Index/TestSnapshot.c
@@ -31,15 +31,15 @@ TestSnapshot_new() {
static void
test_Add_and_Delete(TestBatchRunner *runner) {
Snapshot *snapshot = Snapshot_new();
- CharBuf *foo = (CharBuf*)SSTR_WRAP_STR("foo", 3);
- CharBuf *bar = (CharBuf*)SSTR_WRAP_STR("bar", 3);
+ String *foo = (String*)SSTR_WRAP_STR("foo", 3);
+ String *bar = (String*)SSTR_WRAP_STR("bar", 3);
Snapshot_Add_Entry(snapshot, foo);
Snapshot_Add_Entry(snapshot, foo); // redundant
VArray *entries = Snapshot_List(snapshot);
TEST_INT_EQ(runner, Snapshot_Num_Entries(snapshot), 1,
"One entry added");
- TEST_TRUE(runner, CB_Equals(foo, VA_Fetch(entries, 0)), "correct entry");
+ TEST_TRUE(runner, Str_Equals(foo, VA_Fetch(entries, 0)), "correct entry");
DECREF(entries);
Snapshot_Add_Entry(snapshot, bar);
@@ -55,20 +55,20 @@ static void
test_path_handling(TestBatchRunner *runner) {
Snapshot *snapshot = Snapshot_new();
Folder *folder = (Folder*)RAMFolder_new(NULL);
- CharBuf *snap = (CharBuf*)SSTR_WRAP_STR("snap", 4);
- CharBuf *crackle = (CharBuf*)SSTR_WRAP_STR("crackle", 7);
+ String *snap = (String*)SSTR_WRAP_STR("snap", 4);
+ String *crackle = (String*)SSTR_WRAP_STR("crackle", 7);
Snapshot_Write_File(snapshot, folder, snap);
- TEST_TRUE(runner, CB_Equals(snap, (Obj*)Snapshot_Get_Path(snapshot)),
+ TEST_TRUE(runner, Str_Equals(snap, (Obj*)Snapshot_Get_Path(snapshot)),
"Write_File() sets path as a side effect");
Folder_Rename(folder, snap, crackle);
Snapshot_Read_File(snapshot, folder, crackle);
- TEST_TRUE(runner, CB_Equals(crackle, (Obj*)Snapshot_Get_Path(snapshot)),
+ TEST_TRUE(runner, Str_Equals(crackle, (Obj*)Snapshot_Get_Path(snapshot)),
"Read_File() sets path as a side effect");
Snapshot_Set_Path(snapshot, snap);
- TEST_TRUE(runner, CB_Equals(snap, (Obj*)Snapshot_Get_Path(snapshot)),
+ TEST_TRUE(runner, Str_Equals(snap, (Obj*)Snapshot_Get_Path(snapshot)),
"Set_Path()");
DECREF(folder);
@@ -79,8 +79,8 @@ static void
test_Read_File_and_Write_File(TestBatchRunner *runner) {
Snapshot *snapshot = Snapshot_new();
Folder *folder = (Folder*)RAMFolder_new(NULL);
- CharBuf *snap = (CharBuf*)SSTR_WRAP_STR("snap", 4);
- CharBuf *foo = (CharBuf*)SSTR_WRAP_STR("foo", 3);
+ String *snap = (String*)SSTR_WRAP_STR("snap", 4);
+ String *foo = (String*)SSTR_WRAP_STR("foo", 3);
Snapshot_Add_Entry(snapshot, foo);
Snapshot_Write_File(snapshot, folder, snap);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Test/Plan/TestFieldMisc.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Plan/TestFieldMisc.c b/core/Lucy/Test/Plan/TestFieldMisc.c
index 85b59a5..7b86b43 100644
--- a/core/Lucy/Test/Plan/TestFieldMisc.c
+++ b/core/Lucy/Test/Plan/TestFieldMisc.c
@@ -34,14 +34,14 @@
#include "Lucy/Search/TermQuery.h"
#include "Lucy/Store/RAMFolder.h"
-static CharBuf *analyzed_cb;
-static CharBuf *easy_analyzed_cb;
-static CharBuf *state_cb;
-static CharBuf *states_cb;
-static CharBuf *string_cb;
-static CharBuf *unindexed_but_analyzed_cb;
-static CharBuf *unindexed_unanalyzed_cb;
-static CharBuf *united_states_cb;
+static String *analyzed_cb;
+static String *easy_analyzed_cb;
+static String *state_cb;
+static String *states_cb;
+static String *string_cb;
+static String *unindexed_but_analyzed_cb;
+static String *unindexed_unanalyzed_cb;
+static String *united_states_cb;
TestFieldMisc*
TestFieldMisc_new() {
@@ -50,14 +50,14 @@ TestFieldMisc_new() {
static void
S_init_strings() {
- analyzed_cb = CB_newf("analyzed");
- easy_analyzed_cb = CB_newf("easy_analyzed");
- state_cb = CB_newf("state");
- states_cb = CB_newf("States");
- string_cb = CB_newf("string");
- unindexed_but_analyzed_cb = CB_newf("unindexed_but_analyzed");
- unindexed_unanalyzed_cb = CB_newf("unindexed_unanalyzed");
- united_states_cb = CB_newf("United States");
+ analyzed_cb = Str_newf("analyzed");
+ easy_analyzed_cb = Str_newf("easy_analyzed");
+ state_cb = Str_newf("state");
+ states_cb = Str_newf("States");
+ string_cb = Str_newf("string");
+ unindexed_but_analyzed_cb = Str_newf("unindexed_but_analyzed");
+ unindexed_unanalyzed_cb = Str_newf("unindexed_unanalyzed");
+ united_states_cb = Str_newf("United States");
}
static void
@@ -77,7 +77,7 @@ S_create_schema() {
Schema *schema = Schema_new();
StandardTokenizer *tokenizer = StandardTokenizer_new();
- CharBuf *language = CB_newf("en");
+ String *language = Str_newf("en");
EasyAnalyzer *easy_analyzer = EasyAnalyzer_new(language);
FullTextType *plain = FullTextType_new((Analyzer*)tokenizer);
@@ -113,7 +113,7 @@ S_create_schema() {
}
static void
-S_add_doc(Indexer *indexer, CharBuf *field_name) {
+S_add_doc(Indexer *indexer, String *field_name) {
Doc *doc = Doc_new(NULL, 0);
Doc_Store(doc, field_name, (Obj*)united_states_cb);
Indexer_Add_Doc(indexer, doc, 1.0f);
@@ -121,22 +121,22 @@ S_add_doc(Indexer *indexer, CharBuf *field_name) {
}
static void
-S_check(TestBatchRunner *runner, RAMFolder *folder, CharBuf *field,
- CharBuf *query_text, uint32_t expected_num_hits) {
+S_check(TestBatchRunner *runner, RAMFolder *folder, String *field,
+ String *query_text, uint32_t expected_num_hits) {
TermQuery *query = TermQuery_new(field, (Obj*)query_text);
IndexSearcher *searcher = IxSearcher_new((Obj*)folder);
Hits *hits = IxSearcher_Hits(searcher, (Obj*)query, 0, 10, NULL);
TEST_TRUE(runner, Hits_Total_Hits(hits) == expected_num_hits,
- "%s correct num hits", CB_Get_Ptr8(field));
+ "%s correct num hits", Str_Get_Ptr8(field));
// Don't check the contents of the hit if there aren't any.
if (expected_num_hits) {
HitDoc *hit = Hits_Next(hits);
ViewCharBuf *value = (ViewCharBuf*)SStr_BLANK();
HitDoc_Extract(hit, field, value);
- TEST_TRUE(runner, CB_Equals(united_states_cb, (Obj*)value),
- "%s correct doc returned", CB_Get_Ptr8(field));
+ TEST_TRUE(runner, Str_Equals(united_states_cb, (Obj*)value),
+ "%s correct doc returned", Str_Get_Ptr8(field));
DECREF(hit);
}
@@ -173,10 +173,10 @@ test_spec_field(TestBatchRunner *runner) {
}
static void
-S_add_many_fields_doc(Indexer *indexer, CharBuf *content, int num_fields) {
+S_add_many_fields_doc(Indexer *indexer, String *content, int num_fields) {
Doc *doc = Doc_new(NULL, 0);
for (int32_t i = 1; i <= num_fields; ++i) {
- CharBuf *field = CB_newf("field%i32", i);
+ String *field = Str_newf("field%i32", i);
Doc_Store(doc, field, (Obj*)content);
DECREF(field);
}
@@ -189,26 +189,26 @@ test_many_fields(TestBatchRunner *runner) {
Schema *schema = Schema_new();
StandardTokenizer *tokenizer = StandardTokenizer_new();
FullTextType *type = FullTextType_new((Analyzer*)tokenizer);
- CharBuf *query = CB_newf("x");
+ String *query = Str_newf("x");
for (int32_t num_fields = 1; num_fields <= 10; ++num_fields) {
// Build an index with num_fields fields, and the same content in each.
- CharBuf *field = CB_newf("field%i32", num_fields);
+ String *field = Str_newf("field%i32", num_fields);
Schema_Spec_Field(schema, field, (FieldType*)type);
RAMFolder *folder = RAMFolder_new(NULL);
Indexer *indexer = Indexer_new(schema, (Obj*)folder, NULL, 0);
- CharBuf *content;
+ String *content;
for (int c = 'a'; c <= 'z'; ++c) {
- content = CB_new(1);
- CB_Cat_Char(content, c);
+ content = Str_new(1);
+ Str_Cat_Char(content, c);
S_add_many_fields_doc(indexer, content, num_fields);
DECREF(content);
}
- content = CB_newf("x x y");
+ content = Str_newf("x x y");
S_add_many_fields_doc(indexer, content, num_fields);
DECREF(content);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Test/Plan/TestFieldType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Plan/TestFieldType.c b/core/Lucy/Test/Plan/TestFieldType.c
index 4b377e9..4cb87f2 100644
--- a/core/Lucy/Test/Plan/TestFieldType.c
+++ b/core/Lucy/Test/Plan/TestFieldType.c
@@ -38,7 +38,7 @@ DummyFieldType_new() {
static FieldType*
S_alt_field_type() {
StackString *name = SSTR_WRAP_STR("DummyFieldType2", 15);
- VTable *vtable = VTable_singleton((CharBuf*)name, DUMMYFIELDTYPE);
+ VTable *vtable = VTable_singleton((String*)name, DUMMYFIELDTYPE);
FieldType *self = (FieldType*)VTable_Make_Obj(vtable);
return FType_init(self);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Test/Search/TestQueryParser.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestQueryParser.c b/core/Lucy/Test/Search/TestQueryParser.c
index f51c3c6..4ba025d 100644
--- a/core/Lucy/Test/Search/TestQueryParser.c
+++ b/core/Lucy/Test/Search/TestQueryParser.c
@@ -57,7 +57,7 @@ TestQP_Destroy_IMP(TestQueryParser *self) {
SUPER_DESTROY(self, TESTQUERYPARSER);
}
-CharBuf*
+String*
TestQP_Get_Query_String_IMP(TestQueryParser *self) {
return TestQP_IVARS(self)->query_string;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Test/Search/TestQueryParser.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestQueryParser.cfh b/core/Lucy/Test/Search/TestQueryParser.cfh
index 62b9c74..d4e5969 100644
--- a/core/Lucy/Test/Search/TestQueryParser.cfh
+++ b/core/Lucy/Test/Search/TestQueryParser.cfh
@@ -22,7 +22,7 @@ parcel TestLucy;
class Lucy::Test::Search::TestQueryParser cnick TestQP
inherits Clownfish::Obj {
- CharBuf *query_string;
+ String *query_string;
Query *tree;
Query *expanded;
uint32_t num_hits;
@@ -38,7 +38,7 @@ class Lucy::Test::Search::TestQueryParser cnick TestQP
init(TestQueryParser *self, const char *query_string = NULL,
Query *tree = NULL, Query *expanded = NULL, uint32_t num_hits);
- nullable CharBuf*
+ nullable String*
Get_Query_String(TestQueryParser *self);
nullable Query*
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Test/Search/TestQueryParserLogic.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestQueryParserLogic.c b/core/Lucy/Test/Search/TestQueryParserLogic.c
index 5078818..d60058c 100644
--- a/core/Lucy/Test/Search/TestQueryParserLogic.c
+++ b/core/Lucy/Test/Search/TestQueryParserLogic.c
@@ -864,7 +864,7 @@ S_create_index() {
Indexer *indexer = Indexer_new(schema, (Obj*)folder, NULL, 0);
uint32_t i, max;
- CharBuf *field = (CharBuf*)SSTR_WRAP_STR("content", 7);
+ String *field = (String*)SSTR_WRAP_STR("content", 7);
for (i = 0, max = VA_Get_Size(doc_set); i < max; i++) {
Doc *doc = Doc_new(NULL, 0);
Doc_Store(doc, field, VA_Fetch(doc_set, i));
@@ -892,7 +892,7 @@ TestQPLogic_Run_IMP(TestQueryParserLogic *self, TestBatchRunner *runner) {
NULL, NULL, NULL);
StackString *AND = SSTR_WRAP_STR("AND", 3);
QueryParser *and_parser = QParser_new(IxSearcher_Get_Schema(searcher),
- NULL, (CharBuf*)AND, NULL);
+ NULL, (String*)AND, NULL);
QParser_Set_Heed_Colons(or_parser, true);
QParser_Set_Heed_Colons(and_parser, true);
@@ -906,9 +906,9 @@ TestQPLogic_Run_IMP(TestQueryParserLogic *self, TestBatchRunner *runner) {
Hits *hits = IxSearcher_Hits(searcher, (Obj*)parsed, 0, 10, NULL);
TEST_TRUE(runner, Query_Equals(tree, (Obj*)test_case->tree),
- "tree() OR %s", (char*)CB_Get_Ptr8(test_case->query_string));
+ "tree() OR %s", (char*)Str_Get_Ptr8(test_case->query_string));
TEST_INT_EQ(runner, Hits_Total_Hits(hits), test_case->num_hits,
- "hits: OR %s", (char*)CB_Get_Ptr8(test_case->query_string));
+ "hits: OR %s", (char*)Str_Get_Ptr8(test_case->query_string));
DECREF(hits);
DECREF(parsed);
DECREF(tree);
@@ -925,9 +925,9 @@ TestQPLogic_Run_IMP(TestQueryParserLogic *self, TestBatchRunner *runner) {
Hits *hits = IxSearcher_Hits(searcher, (Obj*)parsed, 0, 10, NULL);
TEST_TRUE(runner, Query_Equals(tree, (Obj*)test_case->tree),
- "tree() AND %s", (char*)CB_Get_Ptr8(test_case->query_string));
+ "tree() AND %s", (char*)Str_Get_Ptr8(test_case->query_string));
TEST_INT_EQ(runner, Hits_Total_Hits(hits), test_case->num_hits,
- "hits: AND %s", (char*)CB_Get_Ptr8(test_case->query_string));
+ "hits: AND %s", (char*)Str_Get_Ptr8(test_case->query_string));
DECREF(hits);
DECREF(parsed);
DECREF(tree);
@@ -939,9 +939,9 @@ TestQPLogic_Run_IMP(TestQueryParserLogic *self, TestBatchRunner *runner) {
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);
- CharBuf *qstring = test_case->tree
+ String *qstring = test_case->tree
? Query_To_String(test_case->tree)
- : CB_new_from_trusted_utf8("(NULL)", 6);
+ : Str_new_from_trusted_utf8("(NULL)", 6);
Query *tree = test_case->tree;
Query *wanted = test_case->expanded;
Query *pruned = QParser_Prune(or_parser, tree);
@@ -949,11 +949,11 @@ TestQPLogic_Run_IMP(TestQueryParserLogic *self, TestBatchRunner *runner) {
Hits *hits;
TEST_TRUE(runner, Query_Equals(pruned, (Obj*)wanted),
- "prune() %s", (char*)CB_Get_Ptr8(qstring));
+ "prune() %s", (char*)Str_Get_Ptr8(qstring));
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", (char*)CB_Get_Ptr8(qstring));
+ "hits: %s", (char*)Str_Get_Ptr8(qstring));
DECREF(hits);
DECREF(expanded);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Test/Search/TestQueryParserSyntax.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestQueryParserSyntax.c b/core/Lucy/Test/Search/TestQueryParserSyntax.c
index 91fb30c..b07799b 100644
--- a/core/Lucy/Test/Search/TestQueryParserSyntax.c
+++ b/core/Lucy/Test/Search/TestQueryParserSyntax.c
@@ -58,13 +58,13 @@ TestQPSyntax_new() {
static Folder*
build_index() {
// Plain type.
- CharBuf *pattern = CB_newf("\\S+");
+ String *pattern = Str_newf("\\S+");
RegexTokenizer *tokenizer = RegexTokenizer_new(pattern);
FullTextType *plain = FullTextType_new((Analyzer*)tokenizer);
// Fancy type.
- CharBuf *word_pattern = CB_newf("\\w+");
+ String *word_pattern = Str_newf("\\w+");
RegexTokenizer *word_tokenizer = RegexTokenizer_new(word_pattern);
Hash *stop_list = Hash_new(0);
@@ -80,8 +80,8 @@ build_index() {
// Schema.
Schema *schema = Schema_new();
- CharBuf *plain_cb = CB_newf("plain");
- CharBuf *fancy_cb = CB_newf("fancy");
+ String *plain_cb = Str_newf("plain");
+ String *fancy_cb = Str_newf("fancy");
Schema_Spec_Field(schema, plain_cb, (FieldType*)plain);
Schema_Spec_Field(schema, fancy_cb, (FieldType*)fancy);
@@ -92,7 +92,7 @@ build_index() {
// Index documents.
VArray *doc_set = TestUtils_doc_set();
for (uint32_t i = 0; i < VA_Get_Size(doc_set); ++i) {
- CharBuf *content_string = (CharBuf*)VA_Fetch(doc_set, i);
+ String *content_string = (String*)VA_Fetch(doc_set, i);
Doc *doc = Doc_new(NULL, 0);
Doc_Store(doc, plain_cb, (Obj*)content_string);
Doc_Store(doc, fancy_cb, (Obj*)content_string);
@@ -405,11 +405,11 @@ test_query_parser_syntax(TestBatchRunner *runner) {
Hits *hits = IxSearcher_Hits(searcher, (Obj*)parsed, 0, 10, NULL);
TEST_TRUE(runner, Query_Equals(tree, (Obj*)ivars->tree),
- "tree() %s", (char*)CB_Get_Ptr8(ivars->query_string));
+ "tree() %s", (char*)Str_Get_Ptr8(ivars->query_string));
TEST_TRUE(runner, Query_Equals(expanded, (Obj*)ivars->expanded),
- "expand_leaf() %s", (char*)CB_Get_Ptr8(ivars->query_string));
+ "expand_leaf() %s", (char*)Str_Get_Ptr8(ivars->query_string));
TEST_INT_EQ(runner, Hits_Total_Hits(hits), ivars->num_hits,
- "hits: %s", (char*)CB_Get_Ptr8(ivars->query_string));
+ "hits: %s", (char*)Str_Get_Ptr8(ivars->query_string));
DECREF(hits);
DECREF(parsed);
DECREF(expanded);
@@ -426,9 +426,9 @@ test_query_parser_syntax(TestBatchRunner *runner) {
Hits *hits = IxSearcher_Hits(searcher, (Obj*)parsed, 0, 10, NULL);
TEST_TRUE(runner, Query_Equals(tree, (Obj*)ivars->tree),
- "tree() %s", (char*)CB_Get_Ptr8(ivars->query_string));
+ "tree() %s", (char*)Str_Get_Ptr8(ivars->query_string));
TEST_INT_EQ(runner, Hits_Total_Hits(hits), ivars->num_hits,
- "hits: %s", (char*)CB_Get_Ptr8(ivars->query_string));
+ "hits: %s", (char*)Str_Get_Ptr8(ivars->query_string));
DECREF(hits);
DECREF(parsed);
DECREF(tree);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Test/Search/TestSortSpec.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestSortSpec.c b/core/Lucy/Test/Search/TestSortSpec.c
index b65d926..19f11ca 100644
--- a/core/Lucy/Test/Search/TestSortSpec.c
+++ b/core/Lucy/Test/Search/TestSortSpec.c
@@ -41,34 +41,34 @@
#include "Lucy/Search/SortRule.h"
#include "Lucy/Store/RAMFolder.h"
-static CharBuf *air_cb;
-static CharBuf *airplane_cb;
-static CharBuf *bike_cb;
-static CharBuf *car_cb;
-static CharBuf *carrot_cb;
-static CharBuf *cat_cb;
-static CharBuf *float32_cb;
-static CharBuf *float64_cb;
-static CharBuf *food_cb;
-static CharBuf *home_cb;
-static CharBuf *int32_cb;
-static CharBuf *int64_cb;
-static CharBuf *land_cb;
-static CharBuf *name_cb;
-static CharBuf *nope_cb;
-static CharBuf *num_cb;
-static CharBuf *random_cb;
-static CharBuf *sloth_cb;
-static CharBuf *speed_cb;
-static CharBuf *unknown_cb;
-static CharBuf *unused_cb;
-static CharBuf *vehicle_cb;
-static CharBuf *weight_cb;
-
-static CharBuf *random_float32s_cb;
-static CharBuf *random_float64s_cb;
-static CharBuf *random_int32s_cb;
-static CharBuf *random_int64s_cb;
+static String *air_cb;
+static String *airplane_cb;
+static String *bike_cb;
+static String *car_cb;
+static String *carrot_cb;
+static String *cat_cb;
+static String *float32_cb;
+static String *float64_cb;
+static String *food_cb;
+static String *home_cb;
+static String *int32_cb;
+static String *int64_cb;
+static String *land_cb;
+static String *name_cb;
+static String *nope_cb;
+static String *num_cb;
+static String *random_cb;
+static String *sloth_cb;
+static String *speed_cb;
+static String *unknown_cb;
+static String *unused_cb;
+static String *vehicle_cb;
+static String *weight_cb;
+
+static String *random_float32s_cb;
+static String *random_float64s_cb;
+static String *random_int32s_cb;
+static String *random_int64s_cb;
TestSortSpec*
TestSortSpec_new() {
@@ -77,34 +77,34 @@ TestSortSpec_new() {
static void
S_init_strings() {
- air_cb = CB_newf("air");
- airplane_cb = CB_newf("airplane");
- bike_cb = CB_newf("bike");
- car_cb = CB_newf("car");
- carrot_cb = CB_newf("carrot");
- cat_cb = CB_newf("cat");
- float32_cb = CB_newf("float32");
- float64_cb = CB_newf("float64");
- food_cb = CB_newf("food");
- home_cb = CB_newf("home");
- int32_cb = CB_newf("int32");
- int64_cb = CB_newf("int64");
- land_cb = CB_newf("land");
- name_cb = CB_newf("name");
- nope_cb = CB_newf("nope");
- num_cb = CB_newf("num");
- random_cb = CB_newf("random");
- sloth_cb = CB_newf("sloth");
- speed_cb = CB_newf("speed");
- unknown_cb = CB_newf("unknown");
- unused_cb = CB_newf("unused");
- vehicle_cb = CB_newf("vehicle");
- weight_cb = CB_newf("weight");
-
- random_float32s_cb = CB_newf("random_float32s");
- random_float64s_cb = CB_newf("random_float64s");
- random_int32s_cb = CB_newf("random_int32s");
- random_int64s_cb = CB_newf("random_int64s");
+ air_cb = Str_newf("air");
+ airplane_cb = Str_newf("airplane");
+ bike_cb = Str_newf("bike");
+ car_cb = Str_newf("car");
+ carrot_cb = Str_newf("carrot");
+ cat_cb = Str_newf("cat");
+ float32_cb = Str_newf("float32");
+ float64_cb = Str_newf("float64");
+ food_cb = Str_newf("food");
+ home_cb = Str_newf("home");
+ int32_cb = Str_newf("int32");
+ int64_cb = Str_newf("int64");
+ land_cb = Str_newf("land");
+ name_cb = Str_newf("name");
+ nope_cb = Str_newf("nope");
+ num_cb = Str_newf("num");
+ random_cb = Str_newf("random");
+ sloth_cb = Str_newf("sloth");
+ speed_cb = Str_newf("speed");
+ unknown_cb = Str_newf("unknown");
+ unused_cb = Str_newf("unused");
+ vehicle_cb = Str_newf("vehicle");
+ weight_cb = Str_newf("weight");
+
+ random_float32s_cb = Str_newf("random_float32s");
+ random_float64s_cb = Str_newf("random_float64s");
+ random_int32s_cb = Str_newf("random_int32s");
+ random_int64s_cb = Str_newf("random_int64s");
}
static void
@@ -226,22 +226,22 @@ S_refresh_indexer(Indexer **indexer, Schema *schema, RAMFolder *folder) {
}
static void
-S_add_vehicle(Indexer *indexer, CharBuf *name, int32_t speed, int32_t sloth,
- int32_t weight, CharBuf *home, CharBuf *cat) {
+S_add_vehicle(Indexer *indexer, String *name, int32_t speed, int32_t sloth,
+ int32_t weight, String *home, String *cat) {
Doc *doc = Doc_new(NULL, 0);
Doc_Store(doc, name_cb, (Obj*)name);
Doc_Store(doc, home_cb, (Obj*)home);
Doc_Store(doc, cat_cb, (Obj*)cat);
- CharBuf *string;
- string = CB_newf("%i32", speed);
+ String *string;
+ string = Str_newf("%i32", speed);
Doc_Store(doc, speed_cb, (Obj*)string);
DECREF(string);
- string = CB_newf("%i32", sloth);
+ string = Str_newf("%i32", sloth);
Doc_Store(doc, sloth_cb, (Obj*)string);
DECREF(string);
- string = CB_newf("%i32", weight);
+ string = Str_newf("%i32", weight);
Doc_Store(doc, weight_cb, (Obj*)string);
DECREF(string);
@@ -251,9 +251,9 @@ S_add_vehicle(Indexer *indexer, CharBuf *name, int32_t speed, int32_t sloth,
}
static void
-S_add_doc(Indexer *indexer, Obj *name_obj, CharBuf *cat, CharBuf *field_name) {
+S_add_doc(Indexer *indexer, Obj *name_obj, String *cat, String *field_name) {
Doc *doc = Doc_new(NULL, 0);
- CharBuf *name = Obj_To_String(name_obj);
+ String *name = Obj_To_String(name_obj);
Doc_Store(doc, name_cb, (Obj*)name);
Doc_Store(doc, cat_cb, (Obj*)cat);
if (field_name) {
@@ -269,10 +269,10 @@ typedef Obj* (*random_generator_t)();
static Obj*
S_random_string() {
size_t length = 1 + rand() % 10;
- CharBuf *string = CB_new(length);
+ String *string = Str_new(length);
while (length--) {
uint32_t code_point = 'a' + rand() % ('z' - 'a' + 1);
- CB_Cat_Char(string, code_point);
+ Str_Cat_Char(string, code_point);
}
return (Obj*)string;
}
@@ -303,8 +303,8 @@ S_random_float64() {
static VArray*
S_add_random_objects(Indexer **indexer, Schema *schema, RAMFolder *folder,
- random_generator_t rng, CharBuf *field_name,
- CharBuf *cat) {
+ random_generator_t rng, String *field_name,
+ String *cat) {
VArray *objects = VA_new(100);
for (int i = 0; i < 100; ++i) {
@@ -320,7 +320,7 @@ S_add_random_objects(Indexer **indexer, Schema *schema, RAMFolder *folder,
for (int i = 0; i < 100; ++i) {
Obj *obj = VA_Fetch(objects, i);
- CharBuf *string = Obj_To_String(obj);
+ String *string = Obj_To_String(obj);
VA_Store(objects, i, (Obj*)string);
}
@@ -328,14 +328,14 @@ S_add_random_objects(Indexer **indexer, Schema *schema, RAMFolder *folder,
}
static VArray*
-S_test_sorted_search(IndexSearcher *searcher, CharBuf *query,
+S_test_sorted_search(IndexSearcher *searcher, String *query,
uint32_t num_wanted, ...) {
VArray *rules = VA_new(2);
- CharBuf *field;
+ String *field;
va_list args;
va_start(args, num_wanted);
- while (NULL != (field = va_arg(args, CharBuf*))) {
+ while (NULL != (field = va_arg(args, String*))) {
bool reverse = va_arg(args, int);
SortRule *rule = SortRule_new(SortRule_FIELD, field, reverse);
VA_Push(rules, (Obj*)rule);
@@ -352,7 +352,7 @@ S_test_sorted_search(IndexSearcher *searcher, CharBuf *query,
HitDoc *hit_doc;
while (NULL != (hit_doc = Hits_Next(hits))) {
HitDoc_Extract(hit_doc, name_cb, name);
- VA_Push(results, (Obj*)CB_Clone((CharBuf*)name));
+ VA_Push(results, (Obj*)Str_Clone((String*)name));
DECREF(hit_doc);
}
@@ -365,7 +365,7 @@ S_test_sorted_search(IndexSearcher *searcher, CharBuf *query,
typedef struct SortContext {
IndexSearcher *searcher;
- CharBuf *sort_field;
+ String *sort_field;
} SortContext;
static void
@@ -462,7 +462,7 @@ test_sort_spec(TestBatchRunner *runner) {
error = Err_trap(S_attempt_sorted_search, &sort_ctx);
TEST_TRUE(runner, error != NULL
&& Err_Is_A(error, ERR)
- && CB_Find_Str(Err_Get_Mess(error), "sortable", 8) != -1,
+ && Str_Find_Str(Err_Get_Mess(error), "sortable", 8) != -1,
"sorting on a non-sortable field throws an error");
DECREF(error);
@@ -470,7 +470,7 @@ test_sort_spec(TestBatchRunner *runner) {
error = Err_trap(S_attempt_sorted_search, &sort_ctx);
TEST_TRUE(runner, error != NULL
&& Err_Is_A(error, ERR)
- && CB_Find_Str(Err_Get_Mess(error), "sortable", 8) != -1,
+ && Str_Find_Str(Err_Get_Mess(error), "sortable", 8) != -1,
"sorting on an unknown field throws an error");
DECREF(error);
#endif
@@ -551,7 +551,7 @@ test_sort_spec(TestBatchRunner *runner) {
"float64");
DECREF(results);
- CharBuf *bbbcca_cb = CB_newf("bike bike bike car car airplane");
+ String *bbbcca_cb = Str_newf("bike bike bike car car airplane");
results = S_test_sorted_search(searcher, bbbcca_cb, 100,
unused_cb, false, NULL);
VA_Clear(wanted);
@@ -563,8 +563,8 @@ test_sort_spec(TestBatchRunner *runner) {
DECREF(results);
DECREF(bbbcca_cb);
- CharBuf *nn_cb = CB_newf("99");
- CharBuf *nn_or_car_cb = CB_newf("99 OR car");
+ String *nn_cb = Str_newf("99");
+ String *nn_or_car_cb = Str_newf("99 OR car");
results = S_test_sorted_search(searcher, nn_or_car_cb, 10,
speed_cb, false, NULL);
VA_Clear(wanted);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Test/Store/MockFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/MockFileHandle.c b/core/Lucy/Test/Store/MockFileHandle.c
index 9c08e0c..b3f0693 100644
--- a/core/Lucy/Test/Store/MockFileHandle.c
+++ b/core/Lucy/Test/Store/MockFileHandle.c
@@ -23,13 +23,13 @@
#include "Lucy/Store/FileWindow.h"
MockFileHandle*
-MockFileHandle_new(const CharBuf *path, int64_t length) {
+MockFileHandle_new(const String *path, int64_t length) {
MockFileHandle *self = (MockFileHandle*)VTable_Make_Obj(MOCKFILEHANDLE);
return MockFileHandle_init(self, path, length);
}
MockFileHandle*
-MockFileHandle_init(MockFileHandle *self, const CharBuf *path,
+MockFileHandle_init(MockFileHandle *self, const String *path,
int64_t length) {
FH_do_open((FileHandle*)self, path, 0);
MockFileHandleIVARS *const ivars = MockFileHandle_IVARS(self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Test/Store/MockFileHandle.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/MockFileHandle.cfh b/core/Lucy/Test/Store/MockFileHandle.cfh
index a88468f..8b3ed59 100644
--- a/core/Lucy/Test/Store/MockFileHandle.cfh
+++ b/core/Lucy/Test/Store/MockFileHandle.cfh
@@ -23,10 +23,10 @@ class Lucy::Store::MockFileHandle inherits Lucy::Store::FileHandle {
int64_t len;
inert incremented MockFileHandle*
- new(const CharBuf *path = NULL, int64_t length);
+ new(const String *path = NULL, int64_t length);
inert MockFileHandle*
- init(MockFileHandle *self, const CharBuf *path = NULL, int64_t length);
+ init(MockFileHandle *self, const String *path = NULL, int64_t length);
bool
Window(MockFileHandle *self, FileWindow *window, int64_t offset, int64_t len);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Test/Store/TestCompoundFileReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestCompoundFileReader.c b/core/Lucy/Test/Store/TestCompoundFileReader.c
index 7166a35..d28075b 100644
--- a/core/Lucy/Test/Store/TestCompoundFileReader.c
+++ b/core/Lucy/Test/Store/TestCompoundFileReader.c
@@ -29,14 +29,14 @@
#include "Lucy/Store/RAMFolder.h"
#include "Lucy/Util/Json.h"
-static CharBuf *cfmeta_file = NULL;
-static CharBuf *cfmeta_temp = NULL;
-static CharBuf *cf_file = NULL;
-static CharBuf *foo = NULL;
-static CharBuf *bar = NULL;
-static CharBuf *baz = NULL;
-static CharBuf *seg_1 = NULL;
-static CharBuf *stuff = NULL;
+static String *cfmeta_file = NULL;
+static String *cfmeta_temp = NULL;
+static String *cf_file = NULL;
+static String *foo = NULL;
+static String *bar = NULL;
+static String *baz = NULL;
+static String *seg_1 = NULL;
+static String *stuff = NULL;
TestCompoundFileReader*
TestCFReader_new() {
@@ -45,14 +45,14 @@ TestCFReader_new() {
static void
S_init_strings(void) {
- cfmeta_file = CB_newf("cfmeta.json");
- cfmeta_temp = CB_newf("cfmeta.json.temp");
- cf_file = CB_newf("cf.dat");
- foo = CB_newf("foo");
- bar = CB_newf("bar");
- baz = CB_newf("baz");
- seg_1 = CB_newf("seg_1");
- stuff = CB_newf("stuff");
+ cfmeta_file = Str_newf("cfmeta.json");
+ cfmeta_temp = Str_newf("cfmeta.json.temp");
+ cf_file = Str_newf("cf.dat");
+ foo = Str_newf("foo");
+ bar = Str_newf("bar");
+ baz = Str_newf("baz");
+ seg_1 = Str_newf("seg_1");
+ stuff = Str_newf("stuff");
}
static void
@@ -79,7 +79,7 @@ S_folder_with_contents() {
DECREF(foo_out);
DECREF(bar_out);
StackString *empty = SStr_BLANK();
- RAMFolder_Consolidate(folder, (CharBuf*)empty);
+ RAMFolder_Consolidate(folder, (String*)empty);
return (Folder*)folder;
}
@@ -112,7 +112,7 @@ test_open(TestBatchRunner *runner) {
Err_set_error(NULL);
real_folder = S_folder_with_contents();
metadata = (Hash*)Json_slurp_json(real_folder, cfmeta_file);
- Hash_Store_Str(metadata, "format", 6, (Obj*)CB_newf("%i32", -1));
+ Hash_Store_Str(metadata, "format", 6, (Obj*)Str_newf("%i32", -1));
Folder_Delete(real_folder, cfmeta_file);
Json_spew_json((Obj*)metadata, real_folder, cfmeta_file);
cf_reader = CFReader_open(real_folder);
@@ -122,7 +122,7 @@ test_open(TestBatchRunner *runner) {
"Set Err_error when format is invalid");
Err_set_error(NULL);
- Hash_Store_Str(metadata, "format", 6, (Obj*)CB_newf("%i32", 1000));
+ Hash_Store_Str(metadata, "format", 6, (Obj*)Str_newf("%i32", 1000));
Folder_Delete(real_folder, cfmeta_file);
Json_spew_json((Obj*)metadata, real_folder, cfmeta_file);
cf_reader = CFReader_open(real_folder);
@@ -142,7 +142,7 @@ test_open(TestBatchRunner *runner) {
"Set Err_error when format key is missing");
Hash_Store_Str(metadata, "format", 6,
- (Obj*)CB_newf("%i32", CFWriter_current_file_format));
+ (Obj*)Str_newf("%i32", CFWriter_current_file_format));
DECREF(Hash_Delete_Str(metadata, "files", 5));
Folder_Delete(real_folder, cfmeta_file);
Json_spew_json((Obj*)metadata, real_folder, cfmeta_file);
@@ -251,11 +251,11 @@ test_Local_Open_Dir(TestBatchRunner *runner) {
DirHandle *dh = CFReader_Local_Open_Dir(cf_reader);
while (DH_Next(dh)) {
- CharBuf *entry = DH_Get_Entry(dh);
- if (CB_Equals(entry, (Obj*)foo)) {
+ String *entry = DH_Get_Entry(dh);
+ if (Str_Equals(entry, (Obj*)foo)) {
saw_foo = true;
}
- else if (CB_Equals(entry, (Obj*)stuff)) {
+ else if (Str_Equals(entry, (Obj*)stuff)) {
saw_stuff = true;
stuff_was_dir = DH_Entry_Is_Dir(dh);
}
@@ -319,7 +319,7 @@ test_Local_Open_In(TestBatchRunner *runner) {
TEST_TRUE(runner, instream != NULL,
"Local_Open_In for virtual file");
TEST_TRUE(runner,
- CB_Starts_With(InStream_Get_Filename(instream), CFReader_Get_Path(cf_reader)),
+ Str_Starts_With(InStream_Get_Filename(instream), CFReader_Get_Path(cf_reader)),
"InStream's path includes directory");
DECREF(instream);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Test/Store/TestCompoundFileWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestCompoundFileWriter.c b/core/Lucy/Test/Store/TestCompoundFileWriter.c
index 01926bf..5ed0565 100644
--- a/core/Lucy/Test/Store/TestCompoundFileWriter.c
+++ b/core/Lucy/Test/Store/TestCompoundFileWriter.c
@@ -26,12 +26,12 @@
#include "Lucy/Store/RAMFolder.h"
#include "Lucy/Util/Json.h"
-static CharBuf *cfmeta_file = NULL;
-static CharBuf *cfmeta_temp = NULL;
-static CharBuf *cf_file = NULL;
-static CharBuf *foo = NULL;
-static CharBuf *bar = NULL;
-static CharBuf *seg_1 = NULL;
+static String *cfmeta_file = NULL;
+static String *cfmeta_temp = NULL;
+static String *cf_file = NULL;
+static String *foo = NULL;
+static String *bar = NULL;
+static String *seg_1 = NULL;
TestCompoundFileWriter*
TestCFWriter_new() {
@@ -40,12 +40,12 @@ TestCFWriter_new() {
static void
S_init_strings(void) {
- cfmeta_file = CB_newf("cfmeta.json");
- cfmeta_temp = CB_newf("cfmeta.json.temp");
- cf_file = CB_newf("cf.dat");
- foo = CB_newf("foo");
- bar = CB_newf("bar");
- seg_1 = CB_newf("seg_1");
+ cfmeta_file = Str_newf("cfmeta.json");
+ cfmeta_temp = Str_newf("cfmeta.json.temp");
+ cf_file = Str_newf("cf.dat");
+ foo = Str_newf("foo");
+ bar = Str_newf("bar");
+ seg_1 = Str_newf("seg_1");
}
static void
@@ -116,7 +116,7 @@ test_offsets(TestBatchRunner *runner) {
files = (Hash*)CERTIFY(
Hash_Fetch_Str(cf_metadata, "files", 5), HASH);
- CharBuf *file;
+ String *file;
Obj *filestats;
bool offsets_ok = true;
@@ -130,7 +130,7 @@ test_offsets(TestBatchRunner *runner) {
if (offs % 8 != 0) {
offsets_ok = false;
FAIL(runner, "Offset %" PRId64 " for %s not a multiple of 8",
- offset, CB_Get_Ptr8(file));
+ offset, Str_Get_Ptr8(file));
break;
}
}