summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Integration/JSONScript/TestCases/p-0410.json
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Integration/JSONScript/TestCases/p-0410.json')
-rw-r--r--www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Integration/JSONScript/TestCases/p-0410.json458
1 files changed, 458 insertions, 0 deletions
diff --git a/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Integration/JSONScript/TestCases/p-0410.json b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Integration/JSONScript/TestCases/p-0410.json
new file mode 100644
index 00000000..b060badc
--- /dev/null
+++ b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Integration/JSONScript/TestCases/p-0410.json
@@ -0,0 +1,458 @@
+{
+ "description": "Test in-text annotation on `_num`/`_tem`/`_qty` type with denoted precision (`_PREC`) and/or `-p<num>` printout precision marker (#1335, en)",
+ "setup": [
+ {
+ "namespace": "SMW_NS_PROPERTY",
+ "page": "Has temperature with prec4",
+ "contents": "[[Has type::Temperature]] [[Display precision of::4]]"
+ },
+ {
+ "namespace": "SMW_NS_PROPERTY",
+ "page": "Has temperature with prec2",
+ "contents": "[[Has type::Temperature]] [[Display precision of::2]]"
+ },
+ {
+ "namespace": "SMW_NS_PROPERTY",
+ "page": "Has temperature",
+ "contents": "[[Has type::Temperature]]"
+ },
+ {
+ "namespace": "SMW_NS_PROPERTY",
+ "page": "Has number with prec4",
+ "contents": "[[Has type::Number]] [[Display precision of::4]]"
+ },
+ {
+ "namespace": "SMW_NS_PROPERTY",
+ "page": "Has number with prec2",
+ "contents": "[[Has type::Number]] [[Display precision of::2]]"
+ },
+ {
+ "namespace": "SMW_NS_PROPERTY",
+ "page": "Has number",
+ "contents": "[[Has type::Number]]"
+ },
+ {
+ "namespace": "SMW_NS_PROPERTY",
+ "page": "Has area",
+ "contents": "[[Has type::Quantity]] [[Corresponds to::1 km²]] [[Corresponds to::0.38610 sq mi]] [[Corresponds to::1000 m²]]"
+ },
+ {
+ "namespace": "SMW_NS_PROPERTY",
+ "page": "Has area with prec4",
+ "contents": "[[Has type::Quantity]] [[Corresponds to::1 km²]] [[Corresponds to::0.38610 sq mi]] [[Corresponds to::1000 m²]] [[Display precision of::4]]"
+ },
+ {
+ "namespace": "SMW_NS_PROPERTY",
+ "page": "Has area with prec2",
+ "contents": "[[Has type::Quantity]] [[Corresponds to::1 km²]] [[Corresponds to::0.38610 sq mi]] [[Corresponds to::1000 m²]] [[Display precision of::2]]"
+ },
+ {
+ "namespace": "SMW_NS_PROPERTY",
+ "page": "Has area with prec0",
+ "contents": "[[Has type::Quantity]] [[Corresponds to::1 km²]] [[Corresponds to::0.38610 sq mi]] [[Corresponds to::1000 m²]] [[Display precision of::0]]"
+ },
+ {
+ "namespace": "SMW_NS_PROPERTY",
+ "page": "Has currency with prec2",
+ "contents": "[[Has type::Quantity]] [[Display units::€, ¥]] [[Corresponds to:: € 1.00]] [[Corresponds to::¥,JPY,Japanese Yen 114.2121]] [[Display precision of::2]]"
+ },
+ {
+ "namespace": "SMW_NS_PROPERTY",
+ "page": "Has currency with prec4",
+ "contents": "[[Has type::Quantity]] [[Display units::€, ¥]] [[Corresponds to:: € 1.00]] [[Corresponds to::¥,JPY,Japanese Yen 114.2121]] [[Display precision of::4]]"
+ },
+ {
+ "page": "Example/P0410/1",
+ "contents": "[[Has temperature with prec4::32 °F]] [[Has temperature with prec4::100 °C]]"
+ },
+ {
+ "page": "Example/P0410/2",
+ "contents": "[[Has temperature with prec2::32 °F]] [[Has temperature with prec2::100 °C]]"
+ },
+ {
+ "page": "Example/P0410/1/1",
+ "contents": "{{#ask: [[Has temperature with prec4::32 °F]] |?Has temperature with prec4 |+order=asc |format=table }}"
+ },
+ {
+ "page": "Example/P0410/2/1",
+ "contents": "{{#ask: [[Has temperature with prec2::32 °F]] |?Has temperature with prec2 |+order=asc |format=table }}"
+ },
+ {
+ "page": "Example/P0410/3/1",
+ "contents": "[[Has number with prec4::.001]] [[Has number with prec2::.001]] [[Has number::.003]]"
+ },
+ {
+ "page": "Example/P0410/3/2",
+ "contents": "[[Has number with prec4::.005]] [[Has number with prec2::.005]] [[Has number::.008]]"
+ },
+ {
+ "page": "Example/P0410/3/3",
+ "contents": "[[Has number with prec2::42]] [[Has number::42]]"
+ },
+ {
+ "page": "Example/P0410/3/4",
+ "contents": "[[Has number with prec2::10,000]] [[Has number::10,000]]"
+ },
+ {
+ "page": "Example/P0410/3",
+ "contents": "{{#ask: [[~Example/P0410/3/*]] |?Has number with prec4 |?Has number with prec2 |?Has number |format=table }}"
+ },
+ {
+ "page": "Example/P0410/4/1",
+ "contents": "[[Has area with prec2::10,000 m²]] [[Has area with prec4::0.02 km²]] [[Has area with prec0::3.33 km²]]"
+ },
+ {
+ "page": "Example/P0410/4",
+ "contents": "{{#ask: [[~Example/P0410/4/*]] |?Has area with prec4 |?Has area with prec2 |?Has area with prec0 |format=table }}"
+ },
+ {
+ "page": "Example/P0410/5/1",
+ "contents": "[[Has currency with prec2::€ 5]] [[Has currency with prec4::¥ 100]]"
+ },
+ {
+ "page": "Example/P0410/5/2",
+ "contents": "[[Has currency with prec2::€ 5,000]] [[Has currency with prec4::¥ 0.50]]"
+ },
+ {
+ "page": "Example/P0410/5",
+ "contents": "{{#ask: [[~Example/P0410/5/*]] |?Has currency with prec4 |?Has currency with prec2 |format=table }}"
+ },
+ {
+ "page": "Example/P0410/6/1",
+ "contents": "[[Has number::10,000]] [[Has number::.005]] [[Has number::42.005]] [[Has number::1001]]"
+ },
+ {
+ "page": "Example/P0410/6a",
+ "contents": "{{#ask: [[~Example/P0410/6/*]] |?Has number#-p2 |format=table }}"
+ },
+ {
+ "page": "Example/P0410/6b",
+ "contents": "{{#ask: [[~Example/P0410/6/*]] |?Has number#-p4 |format=table }}"
+ },
+ {
+ "page": "Example/P0410/6c",
+ "contents": "{{#ask: [[~Example/P0410/6/*]] |?Has number#-p3-n |format=table }}"
+ },
+ {
+ "page": "Example/P0410/7/1",
+ "contents": "[[Has area::10,000 m²]] [[Has area::0.02 km²]] [[Has area::3.33 km²]]"
+ },
+ {
+ "page": "Example/P0410/7a",
+ "contents": "{{#ask: [[~Example/P0410/7/*]] |?Has area#-p2 |format=table }}"
+ },
+ {
+ "page": "Example/P0410/7b",
+ "contents": "{{#ask: [[~Example/P0410/7/*]] |?Has area#m²-p3 |format=table }}"
+ },
+ {
+ "page": "Example/P0410/7c",
+ "contents": "{{#ask: [[~Example/P0410/7/*]] |?Has area#-n-p2 |format=table }}"
+ },
+ {
+ "page": "Example/P0410/8/1",
+ "contents": "[[Has temperature::32 °F]] [[Has temperature::100 °C]]"
+ },
+ {
+ "page": "Example/P0410/8a",
+ "contents": "{{#ask: [[~Example/P0410/8/*]] |?Has temperature#-p2 |format=table }}"
+ },
+ {
+ "page": "Example/P0410/8b",
+ "contents": "{{#ask: [[~Example/P0410/8/*]] |?Has temperature#°C-p3 |format=table }}"
+ },
+ {
+ "page": "Example/P0410/8c",
+ "contents": "{{#ask: [[~Example/P0410/8/*]] |?Has temperature#-n-p2 |format=table }}"
+ }
+ ],
+ "tests": [
+ {
+ "type": "parser",
+ "about": "#0",
+ "subject": "Example/P0410/1",
+ "assert-store": {
+ "semantic-data": {
+ "strictPropertyValueMatch": false,
+ "propertyCount": 3,
+ "propertyKeys": [
+ "Has_temperature_with_prec4",
+ "_SKEY",
+ "_MDAT"
+ ],
+ "propertyValues": [
+ 273.15,
+ 373.15
+ ]
+ }
+ }
+ },
+ {
+ "type": "parser",
+ "about": "#1",
+ "subject": "Example/P0410/2",
+ "assert-store": {
+ "semantic-data": {
+ "strictPropertyValueMatch": false,
+ "propertyCount": 3,
+ "propertyKeys": [
+ "Has_temperature_with_prec2",
+ "_SKEY",
+ "_MDAT"
+ ],
+ "propertyValues": [
+ 273.15,
+ 373.15
+ ]
+ }
+ }
+ },
+ {
+ "type": "parser",
+ "about": "#2",
+ "subject": "Example/P0410/1/1",
+ "assert-output": {
+ "to-contain": [
+ "data-sort-value=\"273.15\"",
+ "<span class=\"smwtext\">273.1500&#160;K</span>",
+ "0.0000&#160;°C",
+ "32.0000&#160;°F",
+ "491.6700&#160;°R",
+ "<span class=\"smwtext\">373.1500&#160;K</span>",
+ "100.0000&#160;°C",
+ "212.0000&#160;°F",
+ "671.6700&#160;°R"
+ ]
+ }
+ },
+ {
+ "type": "parser",
+ "about": "#3",
+ "subject": "Example/P0410/2/1",
+ "assert-output": {
+ "to-contain": [
+ "data-sort-value=\"273.15\"",
+ "<span class=\"smwtext\">273.15&#160;K</span>",
+ "0.00&#160;°C",
+ "32.00&#160;°F",
+ "491.67&#160;°R",
+ "<span class=\"smwtext\">373.15&#160;K</span>",
+ "100.00&#160;°C",
+ "212.00&#160;°F",
+ "671.67&#160;°R"
+ ]
+ }
+ },
+ {
+ "type": "parser",
+ "about": "#4 Prec2 vs Prec4 incl. rounding on output for plain number",
+ "subject": "Example/P0410/3",
+ "assert-output": {
+ "to-contain": [
+ "class=\"Has-number-with-prec4 smwtype_num\" data-sort-value=\"0.001\">0.0010",
+ "class=\"Has-number-with-prec2 smwtype_num\" data-sort-value=\"0.001\">0.00",
+ "class=\"Has-number smwtype_num\" data-sort-value=\"0.003\">0.003",
+ "class=\"Has-number-with-prec4 smwtype_num\" data-sort-value=\"0.005\">0.0050",
+ "class=\"Has-number-with-prec2 smwtype_num\" data-sort-value=\"0.005\">0.01",
+ "class=\"Has-number smwtype_num\" data-sort-value=\"0.008\">0.008",
+ "class=\"Has-number-with-prec2 smwtype_num\" data-sort-value=\"42\">42.00",
+ "class=\"Has-number smwtype_num\" data-sort-value=\"42\">42",
+ "class=\"Has-number-with-prec2 smwtype_num\" data-sort-value=\"10000\">10,000.00",
+ "class=\"Has-number smwtype_num\" data-sort-value=\"10000\">10,000"
+ ]
+ }
+ },
+ {
+ "type": "parser",
+ "about": "#5 Prec2 vs Prec4 vs Prc0 quantity output",
+ "subject": "Example/P0410/4",
+ "assert-output": {
+ "to-contain": [
+ "class=\"Has-area-with-prec4 smwtype_qty\" data-sort-value=\"0.02\"",
+ "0.0200&#160;km²",
+ "0.0077&#160;sqmi",
+ "20.0000&#160;m²",
+ "class=\"Has-area-with-prec2 smwtype_qty\" data-sort-value=\"10\"",
+ "10.00&#160;km²",
+ "3.86&#160;sqmi",
+ "10,000.00&#160;m²",
+ "class=\"Has-area-with-prec0 smwtype_qty\" data-sort-value=\"3.33\"",
+ "3&#160;km²",
+ "1&#160;sqmi",
+ "3,330&#160;m²"
+ ]
+ }
+ },
+ {
+ "type": "parser",
+ "about": "#6 on currency output",
+ "subject": "Example/P0410/5",
+ "assert-output": {
+ "to-contain": [
+ "class=\"Has-currency-with-prec4 smwtype_qty\" data-sort-value=\"0.87556397264388\"",
+ "€&#160;0.8756",
+ "¥&#160;100.0000",
+ "class=\"Has-currency-with-prec2 smwtype_qty\" data-sort-value=\"5\"",
+ "€&#160;5.00",
+ "¥&#160;571.06",
+ "class=\"Has-currency-with-prec4 smwtype_qty\" data-sort-value=\"0.0043778198632194\"",
+ "€&#160;0.0044",
+ "¥&#160;0.5000",
+ "class=\"Has-currency-with-prec2 smwtype_qty\" data-sort-value=\"5000\"",
+ "€&#160;5,000.00",
+ "¥&#160;571,060.50"
+ ]
+ }
+ },
+ {
+ "type": "parser",
+ "about": "#7 on number output without property defined precision, uses -p4 printout marker",
+ "subject": "Example/P0410/6a",
+ "assert-output": {
+ "to-contain": [
+ "class=\"Has-number smwtype_num\" data-sort-value=\"10000\"",
+ "10,000.00",
+ "0.01",
+ "42.01",
+ "1,001.00"
+ ]
+ }
+ },
+ {
+ "type": "parser",
+ "about": "#8 on number output without property defined precision, uses -p4 printout marker",
+ "subject": "Example/P0410/6b",
+ "assert-output": {
+ "to-contain": [
+ "class=\"Has-number smwtype_num\" data-sort-value=\"10000\"",
+ "10,000.0000",
+ "0.0050",
+ "42.0050",
+ "1,001.0000"
+ ]
+ }
+ },
+ {
+ "type": "parser",
+ "about": "#9 on number output without property defined precision, uses -p3-n printout marker",
+ "subject": "Example/P0410/6c",
+ "assert-output": {
+ "to-contain": [
+ "class=\"Has-number smwtype_num\" data-sort-value=\"10000\"",
+ "10000.000",
+ "0.005",
+ "42.005",
+ "1001.000"
+ ]
+ }
+ },
+ {
+ "type": "parser",
+ "about": "#10 on quantity output without property defined precision, uses -p2 printout marker",
+ "subject": "Example/P0410/7a",
+ "assert-output": {
+ "to-contain": [
+ "class=\"Has-area smwtype_qty\" data-sort-value=\"10\"",
+ "10.00&#160;km²",
+ "3.86&#160;sqmi",
+ "10,000.00&#160;m²",
+ "0.02&#160;km²",
+ "0.01&#160;sqmi",
+ "20.00&#160;m²",
+ "3.33&#160;km²",
+ "1.29&#160;sqmi",
+ "3,330.00&#160;m²"
+ ]
+ }
+ },
+ {
+ "type": "parser",
+ "about": "#11 on quantity output without property defined precision, uses m²-p3 printout marker",
+ "subject": "Example/P0410/7b",
+ "assert-output": {
+ "to-contain": [
+ "class=\"Has-area smwtype_qty\" data-sort-value=\"10\"",
+ "10,000.000&#160;m²",
+ "10.000&#160;km²",
+ "3.861&#160;sqmi",
+ "20.000&#160;m²",
+ "0.020&#160;km²",
+ "0.008&#160;sqmi",
+ "3,330.000&#160;m²",
+ "3.330&#160;km²",
+ "1.286&#160;sqmi"
+ ]
+ }
+ },
+ {
+ "type": "parser",
+ "about": "#12 on quantity output without property defined precision, uses -n-p2 printout marker",
+ "subject": "Example/P0410/7c",
+ "assert-output": {
+ "to-contain": [
+ "class=\"Has-area smwtype_qty\" data-sort-value=\"10\"",
+ "10.00",
+ "0.02",
+ "3.33"
+ ]
+ }
+ },
+ {
+ "type": "parser",
+ "about": "#13 on temperature output without property defined precision, uses -p2 printout marker",
+ "subject": "Example/P0410/8a",
+ "assert-output": {
+ "to-contain": [
+ "class=\"Has-temperature smwtype_tem\" data-sort-value=\"273.15\"",
+ "class=\"smwtext\">273.15&#160;K",
+ "0.00&#160;°C",
+ "32.00&#160;°F",
+ "491.67&#160;°R",
+ "class=\"smwtext\">373.15&#160;K",
+ "100.00&#160;°C",
+ "212.00&#160;°F",
+ "671.67&#160;°R"
+ ]
+ }
+ },
+ {
+ "type": "parser",
+ "about": "#14 on temperature output without property defined precision, uses °C-p3 printout marker",
+ "subject": "Example/P0410/8b",
+ "assert-output": {
+ "to-contain": [
+ "class=\"Has-temperature smwtype_tem\" data-sort-value=\"273.15\"",
+ "class=\"smwtext\">0.000&#160;°C",
+ "273.150&#160;K",
+ "32.000&#160;°F",
+ "491.670&#160;°R",
+ "class=\"smwtext\">100.000&#160;°C",
+ "373.150&#160;K",
+ "212.000&#160;°F",
+ "671.670&#160;°R"
+ ]
+ }
+ },
+ {
+ "type": "parser",
+ "about": "#15 on temperature output without property defined precision, uses -n-p2 printout marker",
+ "subject": "Example/P0410/8c",
+ "assert-output": {
+ "to-contain": [
+ "class=\"Has-temperature smwtype_tem\" data-sort-value=\"273.15\"",
+ "273.15",
+ "373.15"
+ ]
+ }
+ }
+ ],
+ "settings": {
+ "wgContLang": "en",
+ "wgLang": "en"
+ },
+ "meta": {
+ "version": "2",
+ "is-incomplete": false,
+ "debug": false
+ }
+}