-
-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use assertEquals for verifying quest answers
- Loading branch information
1 parent
9cc28f8
commit bdf02fe
Showing
63 changed files
with
2,143 additions
and
1,960 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
app/src/test/java/de/westnordost/streetcomplete/osm/ShopKtTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package de.westnordost.streetcomplete.osm | ||
|
||
import de.westnordost.streetcomplete.data.osm.edits.update_tags.StringMapChangesBuilder | ||
import de.westnordost.streetcomplete.data.osm.edits.update_tags.StringMapEntryAdd | ||
import de.westnordost.streetcomplete.data.osm.edits.update_tags.StringMapEntryChange | ||
import de.westnordost.streetcomplete.data.osm.edits.update_tags.StringMapEntryDelete | ||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
|
||
class ShopKtTest { | ||
|
||
@Test fun `replaceShop removes all previous survey keys`() { | ||
assertEquals( | ||
setOf( | ||
StringMapEntryAdd("a", "b"), | ||
StringMapEntryDelete("check_date", "1"), | ||
StringMapEntryDelete("lastcheck", "a"), | ||
StringMapEntryDelete("last_checked", "b"), | ||
StringMapEntryDelete("survey:date", "c"), | ||
StringMapEntryDelete("survey_date", "d"), | ||
), | ||
replaceShopApplied( | ||
newTags = mapOf("a" to "b"), | ||
oldTags = mapOf( | ||
"check_date" to "1", | ||
"lastcheck" to "a", | ||
"last_checked" to "b", | ||
"survey:date" to "c", | ||
"survey_date" to "d" | ||
) | ||
) | ||
) | ||
} | ||
|
||
// see KEYS_THAT_SHOULD_BE_REMOVED_WHEN_SHOP_IS_REPLACED | ||
@Test fun `replaceShop removes certain tags connected with the type of shop`() { | ||
assertEquals( | ||
setOf( | ||
StringMapEntryAdd("shop", "ice_cream"), | ||
StringMapEntryDelete("disused:amenity", "yes"), | ||
StringMapEntryDelete("phone", "123456"), | ||
StringMapEntryDelete("name", "Juppiebude"), | ||
StringMapEntryDelete("ref", "1111"), | ||
StringMapEntryDelete("fee", "yes"), | ||
StringMapEntryDelete("office", "it"), | ||
StringMapEntryDelete("tourism", "information"), | ||
StringMapEntryDelete("information", "office"), | ||
), | ||
replaceShopApplied( | ||
newTags = mapOf("shop" to "ice_cream"), | ||
oldTags = mapOf( | ||
"building" to "yes", // <- should not be cleared | ||
"disused:amenity" to "yes", | ||
"phone" to "123456", | ||
"ref" to "1111", | ||
"fee" to "yes", | ||
"nycdoitt:bin" to "22222", | ||
"barrier" to "wall", | ||
"office" to "it", | ||
"tourism" to "information", | ||
"information" to "office", | ||
"name" to "Juppiebude" | ||
) | ||
) | ||
) | ||
} | ||
} | ||
|
||
private fun replaceShopApplied(newTags: Map<String, String>, oldTags: Map<String, String>): Set<StringMapEntryChange> { | ||
val cb = StringMapChangesBuilder(oldTags) | ||
cb.replaceShop(newTags) | ||
return cb.create().changes | ||
} |
Oops, something went wrong.