aboutsummaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorAlexander Dorokhine <adorokhine@google.com>2021-08-06 15:02:55 -0700
committerAlexander Dorokhine <adorokhine@google.com>2021-08-06 15:49:23 -0700
commit90395e474e3e50b6e8a411cc845e05591d971043 (patch)
treea0e67b947c17231cc718a08346e197e5f9c56fb9 /java
parentfc96ecbb346b20d4308ada4c139345613c64ee16 (diff)
parent251c137baa512697657eb77e95b2abba8394dbea (diff)
downloadicing-android12-qpr3-release.tar.gz
Upstream change descriptions: ============== Exclude a data files for tests under the icing/testdata directory. ============ Modify file-backed-vector to 1) include a check that the size of the file is greater than or equal to the number of elements * sizeof(element) and 2) use PWrite to force the system to allocate disk blocks so that we avoid the risk of trying to mmap a region of the file that the system hasn't allocated a block for (and is unable to do so). ============ Fix unused-error and reorder-ctor issues that surfaced in framework ================== Switch to PRId64 string formatting. ================== Conditionally recompute the checksum for PortableFileBackedProtoLog. ================== Fix spammy error log encountered in hit iterator. =================== Fix -Wunused-but-set-variable warnings Bug: 193141896 Bug: 190845688 Bug: 191444782 Test: Presubmit Change-Id: Ic1a641c7d7fbaac62950d3ca5f4632c7c0073c6b
Diffstat (limited to 'java')
-rw-r--r--java/tests/instrumentation/src/com/google/android/icing/IcingSearchEngineTest.java21
1 files changed, 10 insertions, 11 deletions
diff --git a/java/tests/instrumentation/src/com/google/android/icing/IcingSearchEngineTest.java b/java/tests/instrumentation/src/com/google/android/icing/IcingSearchEngineTest.java
index 64f98f6..0cee80c 100644
--- a/java/tests/instrumentation/src/com/google/android/icing/IcingSearchEngineTest.java
+++ b/java/tests/instrumentation/src/com/google/android/icing/IcingSearchEngineTest.java
@@ -59,7 +59,6 @@ import java.util.HashMap;
import java.util.Map;
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
@@ -490,7 +489,6 @@ public final class IcingSearchEngineTest {
}
@Test
- @Ignore("b/190845688")
public void testCJKTSnippets() throws Exception {
assertStatusOk(icingSearchEngine.initialize().getStatus());
@@ -498,12 +496,13 @@ public final class IcingSearchEngineTest {
assertStatusOk(
icingSearchEngine.setSchema(schema, /*ignoreErrorsAndDeleteDocuments=*/ false).getStatus());
- // String: "我每天走路去上班。"
- // ^ ^ ^ ^^
- // UTF16 idx: 0 1 3 5 6
- // Breaks into segments: "我", "每天", "走路", "去", "上班"
- String chinese = "我每天走路去上班。";
- assertThat(chinese.length()).isEqualTo(9);
+ // String: "天是蓝的"
+ // ^ ^^ ^
+ // UTF16 idx: 0 1 2 3
+ // Breaks into segments: "天", "是", "蓝", "的"
+ // "The sky is blue"
+ String chinese = "天是蓝的";
+ assertThat(chinese.length()).isEqualTo(4);
DocumentProto emailDocument1 =
createEmailDocument("namespace", "uri1").toBuilder()
.addProperties(PropertyProto.newBuilder().setName("subject").addStringValues(chinese))
@@ -513,7 +512,7 @@ public final class IcingSearchEngineTest {
// Search and request snippet matching but no windowing.
SearchSpecProto searchSpec =
SearchSpecProto.newBuilder()
- .setQuery("每")
+ .setQuery("是")
.setTermMatchType(TermMatchType.Code.PREFIX)
.build();
ResultSpecProto resultSpecProto =
@@ -552,9 +551,9 @@ public final class IcingSearchEngineTest {
int matchStart = matchProto.getExactMatchUtf16Position();
int matchEnd = matchStart + matchProto.getExactMatchUtf16Length();
assertThat(matchStart).isEqualTo(1);
- assertThat(matchEnd).isEqualTo(3);
+ assertThat(matchEnd).isEqualTo(2);
String match = content.substring(matchStart, matchEnd);
- assertThat(match).isEqualTo("每天");
+ assertThat(match).isEqualTo("是");
}
@Test