Changeset 8811 in josm for trunk/test/unit/org/openstreetmap/josm/actions/search
- Timestamp:
- 2015-10-01T21:06:10+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/actions/search/SearchCompilerTest.java
r8509 r8811 31 31 @Test 32 32 public void testAny() throws Exception { 33 final SearchCompiler.Match c = SearchCompiler.compile("foo" , false, false);33 final SearchCompiler.Match c = SearchCompiler.compile("foo"); 34 34 Assert.assertTrue(c.match(newPrimitive("foobar", "true"))); 35 35 Assert.assertTrue(c.match(newPrimitive("name", "hello-foo-xy"))); … … 39 39 @Test 40 40 public void testEquals() throws Exception { 41 final SearchCompiler.Match c = SearchCompiler.compile("foo=bar" , false, false);41 final SearchCompiler.Match c = SearchCompiler.compile("foo=bar"); 42 42 Assert.assertFalse(c.match(newPrimitive("foobar", "true"))); 43 43 Assert.assertTrue(c.match(newPrimitive("foo", "bar"))); … … 48 48 @Test 49 49 public void testCompare() throws Exception { 50 final SearchCompiler.Match c1 = SearchCompiler.compile("start_date>1950" , false, false);50 final SearchCompiler.Match c1 = SearchCompiler.compile("start_date>1950"); 51 51 Assert.assertTrue(c1.match(newPrimitive("start_date", "1950-01-01"))); 52 52 Assert.assertTrue(c1.match(newPrimitive("start_date", "1960"))); … … 54 54 Assert.assertFalse(c1.match(newPrimitive("start_date", "1000"))); 55 55 Assert.assertTrue(c1.match(newPrimitive("start_date", "101010"))); 56 final SearchCompiler.Match c2 = SearchCompiler.compile("start_date<1960" , false, false);56 final SearchCompiler.Match c2 = SearchCompiler.compile("start_date<1960"); 57 57 Assert.assertTrue(c2.match(newPrimitive("start_date", "1950-01-01"))); 58 58 Assert.assertFalse(c2.match(newPrimitive("start_date", "1960"))); … … 60 60 Assert.assertTrue(c2.match(newPrimitive("start_date", "1000"))); 61 61 Assert.assertTrue(c2.match(newPrimitive("start_date", "200"))); 62 final SearchCompiler.Match c3 = SearchCompiler.compile("name<I" , false, false);62 final SearchCompiler.Match c3 = SearchCompiler.compile("name<I"); 63 63 Assert.assertTrue(c3.match(newPrimitive("name", "Alpha"))); 64 64 Assert.assertFalse(c3.match(newPrimitive("name", "Sigma"))); 65 final SearchCompiler.Match c4 = SearchCompiler.compile("\"start_date\"<1960" , false, false);65 final SearchCompiler.Match c4 = SearchCompiler.compile("\"start_date\"<1960"); 66 66 Assert.assertTrue(c4.match(newPrimitive("start_date", "1950-01-01"))); 67 67 Assert.assertFalse(c4.match(newPrimitive("start_date", "2000"))); … … 83 83 way.addNode(node1); 84 84 way.addNode(node2); 85 Assert.assertFalse(SearchCompiler.compile("nth:2" , false, false).match(node1));86 Assert.assertTrue(SearchCompiler.compile("nth:1" , false, false).match(node1));87 Assert.assertFalse(SearchCompiler.compile("nth:0" , false, false).match(node1));88 Assert.assertTrue(SearchCompiler.compile("nth:0" , false, false).match(node0));89 Assert.assertTrue(SearchCompiler.compile("nth:2" , false, false).match(node2));90 Assert.assertTrue(SearchCompiler.compile("nth:-1" , false, false).match(node2));91 Assert.assertTrue(SearchCompiler.compile("nth:-2" , false, false).match(node1));92 Assert.assertTrue(SearchCompiler.compile("nth:-3" , false, false).match(node0));85 Assert.assertFalse(SearchCompiler.compile("nth:2").match(node1)); 86 Assert.assertTrue(SearchCompiler.compile("nth:1").match(node1)); 87 Assert.assertFalse(SearchCompiler.compile("nth:0").match(node1)); 88 Assert.assertTrue(SearchCompiler.compile("nth:0").match(node0)); 89 Assert.assertTrue(SearchCompiler.compile("nth:2").match(node2)); 90 Assert.assertTrue(SearchCompiler.compile("nth:-1").match(node2)); 91 Assert.assertTrue(SearchCompiler.compile("nth:-2").match(node1)); 92 Assert.assertTrue(SearchCompiler.compile("nth:-3").match(node0)); 93 93 } 94 94 95 95 @Test 96 96 public void testNthParseNegative() throws Exception { 97 Assert.assertThat(SearchCompiler.compile("nth:-1" , false, false).toString(), CoreMatchers.is("Nth{nth=-1, modulo=false}"));97 Assert.assertThat(SearchCompiler.compile("nth:-1").toString(), CoreMatchers.is("Nth{nth=-1, modulo=false}")); 98 98 99 99 }
Note:
See TracChangeset
for help on using the changeset viewer.