Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public static boolean matchStringValue(MatchStringType matchType, String actualV
String[] tokens = matchValue.split(",");
for (String token : tokens) {
if (useTrieNode && trieNodeFunction != null) {
if (TrieUtil.checkSimpleApi(trieNodeFunction.apply(matchValue), actualValue)) {
if (TrieUtil.checkSimpleApi(trieNodeFunction.apply(token), actualValue)) {
return true;
}
} else {
Expand All @@ -127,7 +127,7 @@ public static boolean matchStringValue(MatchStringType matchType, String actualV
String[] tokens = matchValue.split(",");
for (String token : tokens) {
if (useTrieNode && trieNodeFunction != null) {
if (TrieUtil.checkSimpleApi(trieNodeFunction.apply(matchValue), actualValue)) {
if (TrieUtil.checkSimpleApi(trieNodeFunction.apply(token), actualValue)) {
return false;
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ public void testMatchMetadata() {
assertThat(matchMetadata(ruleMeta3, destMeta3)).isTrue();
}

@Test
public void testInMatch() {
assertThat(matchStringValue(ModelProto.MatchString.MatchStringType.IN, "123", "123,456")).isTrue();
assertThat(matchStringValue(ModelProto.MatchString.MatchStringType.IN, "123", "456,123")).isTrue();
assertThat(matchStringValue(ModelProto.MatchString.MatchStringType.IN, "231", "123,456")).isFalse();
assertThat(matchStringValue(ModelProto.MatchString.MatchStringType.NOT_IN, "123", "123,456")).isFalse();
assertThat(matchStringValue(ModelProto.MatchString.MatchStringType.NOT_IN, "123", "456,123")).isFalse();
assertThat(matchStringValue(ModelProto.MatchString.MatchStringType.NOT_IN, "231", "123,456")).isTrue();
}

@Test
public void testRangeMatch() {
assertThat(matchStringValue(ModelProto.MatchString.MatchStringType.RANGE, "123", "123~456")).isTrue();
Expand Down
Loading