Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit tests for grep vis
Browse files Browse the repository at this point in the history
alerman committed Apr 17, 2024
1 parent 4096d0d commit 3bd15c3
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -48,9 +48,13 @@ public class GrepIteratorTest {
public void init() {
input = new TreeMap<>();
output = new TreeMap<>();

input.put(new Key("abcdef", "xyz", "xyz", 0), new Value("xyz"));
output.put(new Key("abcdef", "xyz", "xyz", 0), new Value("xyz"));

input.put(new Key("abcdef", "cv", "cv", "colvis", 0), new Value("cv"));
output.put(new Key("abcdef", "cv", "cv", "colvis", 0), new Value("cv"));

input.put(new Key("bdf", "ace", "xyz", 0), new Value("xyz"));
input.put(new Key("bdf", "abcdef", "xyz", 0), new Value("xyz"));
output.put(new Key("bdf", "abcdef", "xyz", 0), new Value("xyz"));
@@ -97,6 +101,20 @@ public void test() throws IOException {
GrepIterator.setTerm(is, "def");
gi.init(new SortedMapIterator(input), is.getOptions(), null);
gi.seek(new Range(), EMPTY_COL_FAMS, false);

checkEntries(gi, output);

input = new TreeMap<>();
output = new TreeMap<>();

input.put(new Key("abcdef", "cv", "cv", "colvis", 0), new Value("cv"));
input.put(new Key("abcdef", "cv", "cv", "nomatch", 0), new Value("cv"));
output.put(new Key("abcdef", "cv", "cv", "colvis", 0), new Value("cv"));

GrepIterator.setTerm(is, "colvis");
gi.init(new SortedMapIterator(input), is.getOptions(), null);
gi.seek(new Range(), EMPTY_COL_FAMS, false);

checkEntries(gi, output);
}
}
Original file line number Diff line number Diff line change
@@ -464,6 +464,7 @@ public void grepTest() throws IOException {
String expected = "r f:q [vis]\tv";
String expectedTimestamp = "r f:q [vis] 0\tv";
exec("grep", false, "No terms specified");
exec("grep vis", true, expected);
exec("grep non_matching_string", true, "");
// historically, showing few did not pertain to ColVis or Timestamp
exec("grep r", true, expected);

0 comments on commit 3bd15c3

Please sign in to comment.