1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-26 10:00:34 +00:00

Integrate test cases with the docs

This commit is contained in:
jeremy@jermolene.com 2023-04-13 09:39:52 +01:00
parent b6181e1cb1
commit 6d617ce939
14 changed files with 70 additions and 93 deletions

View File

@ -1,26 +0,0 @@
title: Example Test Case
type: text/vnd.tiddlywiki-multiple
title: Description
Testing the geonearest operator
+
title: Output
\whitespace trim
<$let
oxford={{{ [geopoint[51.751944],[-1.257778]jsonset[id],[Oxford]] }}}
winchester={{{ [geopoint[51.0632],[-1.308]jsonset[id],[Winchester]] }}}
new-york={{{ [geopoint[40.730610],[-73.935242]jsonset[id],[New York]] }}}
>
<$text text={{{ =[<oxford>] =[<winchester>] +[geonearestpoint<new-york>jsonget[id]] }}}/>,
<$text text={{{ =[<oxford>] =[[Not a point]] +[geonearestpoint<new-york>jsonget[id]] }}}/>,
<$text text={{{ =[[Not a point]] +[geonearestpoint<new-york>jsonget[id]] }}}/>
</$let>
+
title: ExpectedResult
<p>Winchester,Oxford,</p>

View File

@ -26,22 +26,3 @@ This demo requires that the API keys needed to access external services be obtai
/>
<<tabs tabsList:"[all[tiddlers+shadows]tag[$:/tags/GeospatialDemo]]" default:"GeoMarkers">>
---
! Test Cases
<$testcase testcase-tiddler="Example Test Case">
</$testcase>
<$testcase>
<$data title="Description" text="Testing the ways JavaScript macros can be invoked"/>
<$data title="Output" text="""\whitespace trim
<<makedatauri text:"Wildebeest" type:"text/plain">>
<$macrocall $name="makedatauri" text="Wildebeest" type="text/plain"/>
"""/>
<$data title="ExpectedResult" text="""<p><a class="tc-tiddlylink-external" href="data:text/plain,Wildebeest" rel="noopener noreferrer" target="_blank">data:text/plain,Wildebeest</a></p><p><a class="tc-tiddlylink-external" href="data:text/plain,Wildebeest" rel="noopener noreferrer" target="_blank">data:text/plain,Wildebeest</a></p>
"""/>
</$testcase>

View File

@ -6,13 +6,8 @@ tags: $:/tags/GeospatialDocs
The `geodistance` operator calculates the distance between two points in [[GeoJSON Point Feature]] format. The points are specified as two operands. An optional third operand specifies the units as `miles`, `kilometers`, `degrees` or `radians` (defaults to `miles`).
```
<$let
oxford={{{ [geopoint[51.751944],[-1.257778]] }}}
new-york={{{ [geopoint[40.730610],[-73.935242]] }}}
>
<$text text={{{ [geodistance<oxford>,<new-york>] }}}/>,
<$text text={{{ [geodistance<oxford>,<new-york>,[miles]] }}}/>,
</$let>
```
!! Examples
<$testcase testcase-tiddler="$:/plugins/tiddlywiki/geospatial/tests/operators/geodistance">
<$data $tiddler="$:/plugins/tiddlywiki/geospatial"/>
</$testcase>

View File

@ -8,8 +8,8 @@ The `geolookup` operator identifies the polygon(s) within a [[GeoJSON Polygon Fe
Each input list item is interpreted as a [[GeoJSON Point Feature]] and the operand is interpreted as a [[GeoJSON Polygon Feature Collection]].
For example, here we lookup the point 100.5,0.5 in the [[GeoJSON Polygon Feature Collection]] stored in the tiddler `TestData` and then extracts the indexes `0` and `animal` from the resulting JSON:
!! Examples
```
<$text text={{{ [geopoint[100.5],[0.5]geolookup{TestData}jsonget[0],[animal]] }}}/>
```
<$testcase testcase-tiddler="$:/plugins/tiddlywiki/geospatial/tests/operators/geolookup">
<$data $tiddler="$:/plugins/tiddlywiki/geospatial"/>
</$testcase>

View File

@ -6,16 +6,8 @@ tags: $:/tags/GeospatialDocs
The `geonearestpoint` operator determines the point in a list that is nearest to a target point. Each input list item is interpreted as a [[GeoJSON Point Feature]] comprising the candidate points. The target point is specified as the first operand in [[GeoJSON Point Feature]] format.
```
<$let
oxford={{{ [geopoint[51.751944],[-1.257778]jsonset[id],[Oxford]] }}}
winchester={{{ [geopoint[51.0632],[-1.308]jsonset[id],[Winchester]] }}}
new-york={{{ [geopoint[40.730610],[-73.935242]jsonset[id],[New York]] }}}
>
!! Examples
<$text text={{{ =[<oxford>] =[<winchester>] +[geonearestpoint<new-york>jsonget[id]] }}}/>,
<$text text={{{ =[<oxford>] =[[Not a point]] +[geonearestpoint<new-york>jsonget[id]] }}}/>,
<$text text={{{ =[[Not a point]] +[geonearestpoint<new-york>jsonget[id]] }}}/>
</$let>
```
<$testcase testcase-tiddler="$:/plugins/tiddlywiki/geospatial/tests/operators/geonearestpoint">
<$data $tiddler="$:/plugins/tiddlywiki/geospatial"/>
</$testcase>

View File

@ -14,14 +14,8 @@ The coordinates are specified as two or three operands:
Any operands that cannot be interpreted as a valid number will be interpreted as the value zero.
For example:
!! Examples
```
<$text text={{{ [geopoint[51.751944],[-1.257778]] }}}/>
```
Returns:
```
{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[51.751944,-1.257778,0]}}
```
<$testcase testcase-tiddler="$:/plugins/tiddlywiki/geospatial/tests/operators/geopoint">
<$data $tiddler="$:/plugins/tiddlywiki/geospatial"/>
</$testcase>

View File

@ -6,7 +6,8 @@ tags: $:/tags/GeospatialDocs
The `olc-decode` operator converts an [[OpenLocationCode|https://github.com/google/open-location-code]] shortcut into the [[GeoJSON Point Feature]] at its centre or the [[GeoJSON Polygon Feature]] representing the bounds of the area identified by the input code.
```
[olc-decode:bounds[9C3WQP2R+QV]]
[olc-decode:point[9C3WQP2R+QVH]]
```
!! Examples
<$testcase testcase-tiddler="$:/plugins/tiddlywiki/geospatial/tests/operators/olc-decode">
<$data $tiddler="$:/plugins/tiddlywiki/geospatial"/>
</$testcase>

View File

@ -6,8 +6,8 @@ tags: $:/tags/GeospatialDocs
The `old-encode` operator converts separate latitude and longitude numbers into an [[OpenLocationCode|https://github.com/google/open-location-code]] shortcut code with a specified length (defaults to 11 characters).
```
[olc-encode[51.751944],[-1.257778]]
[olc-encode[51.751944],[-1.257778],[11]]
```
!! Examples
<$testcase testcase-tiddler="$:/plugins/tiddlywiki/geospatial/tests/operators/olc-encode">
<$data $tiddler="$:/plugins/tiddlywiki/geospatial"/>
</$testcase>

View File

@ -1,8 +1,12 @@
title: $:/plugins/tiddlywiki/geospatial/tests/geodistance
title: $:/plugins/tiddlywiki/geospatial/tests/operators/geodistance
description: geodistance operator
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
title: Description
geodistance operator
+
title: Output
\whitespace trim

View File

@ -1,8 +1,12 @@
title: $:/plugins/tiddlywiki/geospatial/tests/geolookup
title: $:/plugins/tiddlywiki/geospatial/tests/operators/geolookup
description: geolookup operator
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
title: Description
geolookup operator
+
title: Output
\whitespace trim

View File

@ -1,8 +1,12 @@
title: $:/plugins/tiddlywiki/geospatial/tests/geonearestpoint
title: $:/plugins/tiddlywiki/geospatial/tests/operators/geonearestpoint
description: geonearestpoint operator
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
title: Description
geonearestpoint operator
+
title: Output
\whitespace trim

View File

@ -3,6 +3,10 @@ description: geopoint operator
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
title: Description
geopoint operator
+
title: Output
<$text text={{{ [geopoint[51.751944],[-1.257778]] }}}/>

View File

@ -1,8 +1,12 @@
title: $:/plugins/tiddlywiki/geospatial/tests/operators/olc
description: olc operators
title: $:/plugins/tiddlywiki/geospatial/tests/operators/olc-decode
description: olc-decode operator
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
title: Description
Open Location Code operators
+
title: Output
(<$text text={{{ [olc-encode[51.751944],[-1.257778]] }}}/>)

View File

@ -0,0 +1,20 @@
title: $:/plugins/tiddlywiki/geospatial/tests/operators/olc-encode
description: olc-encode operator
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
title: Description
Open Location Code operators
+
title: Output
(<$text text={{{ [olc-encode[51.751944],[-1.257778]] }}}/>)
(<$text text={{{ [olc-encode[51.751944],[-1.257778],[11]] }}}/>)
+
title: ExpectedResult
<p>(9C3WQP2R+QV)
(9C3WQP2R+QVH)
</p>