Changeset 16582 in josm for trunk/test/unit/org
- Timestamp:
- 2020-06-08T22:54:35+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/osm/search/SearchCompilerTest.java
r16307 r16582 765 765 return result; 766 766 } 767 768 /** 769 * Search for {@code nodes:2}. 770 * @throws SearchParseError if an error has been encountered while compiling 771 */ 772 @Test 773 public void testNodeCount() throws SearchParseError { 774 final SearchContext sc = new SearchContext("nodes:2"); 775 sc.match(sc.n1, false); 776 sc.match(sc.w1, true); 777 Node n3 = new Node(new LatLon(0, 5)); 778 sc.ds.addPrimitive(n3); 779 sc.w1.addNode(n3); 780 sc.match(sc.w1, false); 781 sc.match(sc.r1, false); 782 } 783 784 /** 785 * Search for {@code ways:2}. 786 * @throws SearchParseError if an error has been encountered while compiling 787 */ 788 @Test 789 public void testWayCount() throws SearchParseError { 790 final SearchContext sc = new SearchContext("ways:2"); 791 sc.match(sc.n1, true); 792 sc.ds.addPrimitive(new Way(sc.w2, true)); 793 sc.match(sc.n1, false); 794 sc.match(sc.w1, false); 795 sc.match(sc.r1, true); 796 sc.r1.addMember(new RelationMember("", sc.n1)); 797 sc.match(sc.r1, true); 798 } 799 800 /** 801 * Search for {@code members:2}. 802 * @throws SearchParseError if an error has been encountered while compiling 803 */ 804 @Test 805 public void testMemberCount() throws SearchParseError { 806 final SearchContext sc = new SearchContext("members:2"); 807 sc.match(sc.n1, false); 808 sc.match(sc.w1, false); 809 sc.match(sc.r1, true); 810 sc.r1.addMember(new RelationMember("", sc.n1)); 811 sc.match(sc.r1, false); 812 } 813 814 /** 815 * Search for {@code role:foo}. 816 * @throws SearchParseError if an error has been encountered while compiling 817 */ 818 @Test 819 public void testRole() throws SearchParseError { 820 final SearchContext sc = new SearchContext("role:foo"); 821 sc.match(sc.r1, false); 822 sc.match(sc.w1, false); 823 sc.match(sc.n1, false); 824 sc.match(sc.n2, false); 825 sc.r1.addMember(new RelationMember("foo", sc.n1)); 826 sc.match(sc.n1, true); 827 sc.match(sc.n2, false); 828 } 767 829 }
Note:
See TracChangeset
for help on using the changeset viewer.