Changeset 32620 in osm for applications/editors/josm/plugins/graphview/test
- Timestamp:
- 2016-07-10T20:44:13+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/FullGraphCreationTest.java
r30737 r32620 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.graphview.core; 2 3 … … 4 5 5 6 import java.util.Arrays; 7 import java.util.Collection; 6 8 import java.util.HashMap; 7 9 import java.util.Iterator; 8 10 import java.util.LinkedList; 11 import java.util.List; 9 12 import java.util.Map; 10 13 … … 49 52 50 53 private static final AccessRuleset TEST_RULESET = new AccessRuleset() { 54 @Override 51 55 public java.util.List<String> getAccessHierarchyAncestors(String transportMode) { 52 56 return Arrays.asList(transportMode); 53 57 } 54 public java.util.Collection<Tag> getBaseTags() { 58 59 @Override 60 public Collection<Tag> getBaseTags() { 55 61 return Arrays.asList(new Tag("highway", "test")); 56 62 } 57 public java.util.List<Implication> getImplications() { 63 64 @Override 65 public List<Implication> getImplications() { 58 66 return new LinkedList<>(); 59 67 } … … 174 182 while (iterator.hasNext()) { 175 183 iterator.next(); 176 size 184 size++; 177 185 } 178 186 return size; -
applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/TestDataSource.java
r30737 r32620 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.graphview.core; 2 3 … … 12 13 import org.openstreetmap.josm.plugins.graphview.core.data.TagGroup; 13 14 14 public class TestDataSource implements DataSource<TestDataSource.TestNode, TestDataSource.TestWay, TestDataSource.TestRelation, TestDataSource.TestRelationMember> { 15 public class TestDataSource 16 implements DataSource<TestDataSource.TestNode, TestDataSource.TestWay, TestDataSource.TestRelation, TestDataSource.TestRelationMember> { 15 17 16 18 public static class TestPrimitive { 17 19 public final Map<String, String> tags = new HashMap<>(); 18 } ;20 } 19 21 20 22 public static class TestNode extends TestPrimitive { … … 24 26 this(0, 0); 25 27 } 28 26 29 public TestNode(double lat, double lon) { 27 30 this.lat = lat; 28 31 this.lon = lon; 29 32 } 33 30 34 @Override 31 35 public String toString() { … … 57 61 this.member = member; 58 62 } 63 59 64 public TestPrimitive getMember() { 60 65 return member; 61 66 } 67 62 68 public String getRole() { 63 69 return role; 64 70 } 71 65 72 @Override 66 73 public String toString() { … … 74 81 public final Collection<TestRelation> relations = new LinkedList<>(); 75 82 76 83 @Override 77 84 public double getLat(TestNode node) { 78 85 return node.lat; 79 86 } 87 88 @Override 80 89 public double getLon(TestNode node) { 81 90 return node.lon; 82 91 } 83 92 93 @Override 84 94 public Iterable<TestRelationMember> getMembers(TestRelation relation) { 85 95 return relation.members; 86 96 } 87 97 98 @Override 88 99 public Iterable<TestNode> getNodes() { 89 100 return nodes; 90 101 } 91 102 103 @Override 92 104 public Iterable<TestNode> getNodes(TestWay way) { 93 105 return way.nodes; 94 106 } 95 107 108 @Override 96 109 public Iterable<TestWay> getWays() { 97 110 return ways; 98 111 } 99 112 113 @Override 100 114 public Iterable<TestRelation> getRelations() { 101 115 return relations; 102 116 } 103 117 118 @Override 104 119 public TagGroup getTagsN(TestNode node) { 105 120 return new MapBasedTagGroup(node.tags); 106 121 } 107 122 123 @Override 108 124 public TagGroup getTagsW(TestWay way) { 109 125 return new MapBasedTagGroup(way.tags); 110 126 } 111 127 128 @Override 112 129 public TagGroup getTagsR(TestRelation relation) { 113 130 return new MapBasedTagGroup(relation.tags); 114 131 } 115 132 133 @Override 116 134 public Object getMember(TestRelationMember member) { 117 135 return member.getMember(); 118 136 } 119 137 138 @Override 120 139 public String getRole(TestRelationMember member) { 121 140 return member.getRole(); 122 141 } 123 142 143 @Override 124 144 public boolean isNMember(TestRelationMember member) { 125 145 return member.getMember() instanceof TestNode; 126 146 } 127 147 148 @Override 128 149 public boolean isWMember(TestRelationMember member) { 129 150 return member.getMember() instanceof TestWay; 130 151 } 131 152 153 @Override 132 154 public boolean isRMember(TestRelationMember member) { 133 155 return member.getMember() instanceof TestRelation; 134 156 } 135 157 158 @Override 136 159 public void addObserver(DataSourceObserver observer) { 137 160 // not needed for test 138 161 } 139 162 163 @Override 140 164 public void deleteObserver(DataSourceObserver observer) { 141 165 // not needed for test -
applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/access/AccessRulesetReaderTest.java
r30737 r32620 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.graphview.core.access; 2 3 -
applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/property/RoadInclineTest.java
r23189 r32620 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.graphview.core.property; 2 3 -
applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/property/RoadMaxspeedTest.java
r23189 r32620 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.graphview.core.property; 2 3 … … 7 8 8 9 private static void testMaxspeed(float expectedMaxspeed, String maxspeedString) { 9 testEvaluateBoth(new RoadMaxspeed(), 10 testEvaluateBoth(new RoadMaxspeed(), expectedMaxspeed, new Tag("maxspeed", maxspeedString)); 10 11 } 11 12 … … 29 30 testMaxspeed(24.14016f, "15 mph"); 30 31 } 31 32 32 } -
applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/property/RoadPropertyTest.java
r30560 r32620 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.graphview.core.property; 2 3 … … 8 9 9 10 @Ignore("no test") 10 abstract publicclass RoadPropertyTest {11 public abstract class RoadPropertyTest { 11 12 12 13 protected static <P> void testEvaluateW(RoadPropertyType<P> property, P expectedForward, P expectedBackward, Tag... wayTags) { -
applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/util/TagConditionLogicTest.java
r30737 r32620 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.graphview.core.util; 2 3 import static org.junit.Assert.assertFalse; -
applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/util/ValueStringParserTest.java
r30550 r32620 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.graphview.core.util; 2 3 … … 88 89 } 89 90 90 private static finalvoid assertClose(float expected, float actual) {91 private static void assertClose(float expected, float actual) { 91 92 if (Math.abs(expected - actual) > 0.001) { 92 93 throw new AssertionError("expected " + expected + ", was " + actual); -
applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/visualisation/FloatPropertyColorSchemeTest.java
r30737 r32620 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.graphview.core.visualisation; 2 3
Note:
See TracChangeset
for help on using the changeset viewer.