lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] [05/17] git commit: refs/heads/cfish-string-prep1 - Eliminate SStr_Assign in TestIndexFileNames
Date Fri, 13 Sep 2013 18:31:37 GMT
Eliminate SStr_Assign in TestIndexFileNames


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/17a4c779
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/17a4c779
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/17a4c779

Branch: refs/heads/cfish-string-prep1
Commit: 17a4c779754111f643a631c5d098af25c2f7bb24
Parents: e409e84
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Sat Sep 7 19:42:15 2013 +0200
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Mon Sep 9 20:17:51 2013 +0200

----------------------------------------------------------------------
 core/Lucy/Test/Util/TestIndexFileNames.c | 29 +++++++++++----------------
 1 file changed, 12 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/17a4c779/core/Lucy/Test/Util/TestIndexFileNames.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestIndexFileNames.c b/core/Lucy/Test/Util/TestIndexFileNames.c
index 6ba675d..c2b55ee 100644
--- a/core/Lucy/Test/Util/TestIndexFileNames.c
+++ b/core/Lucy/Test/Util/TestIndexFileNames.c
@@ -49,24 +49,19 @@ test_local_part(TestBatchRunner *runner) {
 }
 
 static void
-test_extract_gen(TestBatchRunner *runner) {
-    StackString *source = SSTR_WRAP_STR("", 0);
-
-    SStr_Assign_Str(source, "seg_9", 5);
-    TEST_TRUE(runner, IxFileNames_extract_gen((String*)source) == 9,
-              "extract_gen");
-
-    SStr_Assign_Str(source, "seg_9/", 6);
-    TEST_TRUE(runner, IxFileNames_extract_gen((String*)source) == 9,
-              "deal with trailing slash");
-
-    SStr_Assign_Str(source, "seg_9_8", 7);
-    TEST_TRUE(runner, IxFileNames_extract_gen((String*)source) == 9,
-              "Only go past first underscore");
+S_test_extract_gen(TestBatchRunner *runner, const char *name, uint64_t gen,
+                   const char *test_name) {
+    StackString *source = SSTR_WRAP_STR(name, strlen(name));
+    TEST_TRUE(runner, IxFileNames_extract_gen((String*)source) == gen,
+              test_name);
+}
 
-    SStr_Assign_Str(source, "snapshot_5.json", 15);
-    TEST_TRUE(runner, IxFileNames_extract_gen((String*)source) == 5,
-              "Deal with file suffix");
+static void
+test_extract_gen(TestBatchRunner *runner) {
+    S_test_extract_gen(runner, "seg_9", 9, "extract_gen");
+    S_test_extract_gen(runner, "seg_9/", 9, "deal with trailing slash");
+    S_test_extract_gen(runner, "seg_9_8", 9, "Only go past first underscore");
+    S_test_extract_gen(runner, "snapshot_5.json", 5, "Deal with file suffix");
 }
 
 void


Mime
View raw message