gplx/mediawiki/extensions/SemanticMediaWiki/tests/phpunit/Integration/JSONScript/TestCases/p-0208.json

236 lines
4.4 KiB
JSON

{
"description": "Test `#set` for various `_num` values without explicit precision (3 digit implicit), with/without leading zero, different printouts, negative numbers (#753, en, `smwgMaxNonExpNumber`)",
"setup": [
{
"namespace": "SMW_NS_PROPERTY",
"page": "Has number",
"contents": "[[Has type::Number]]"
},
{
"page": "Example/P0208/1",
"contents": "{{#set:Has number=10000;2000;300;40;0;0.1;0.01;0.001;0.0001;0.02;0.003;0.0004;0.00005;4,297.31 e7|+sep=; }}"
},
{
"page": "Example/P0208/2",
"contents": "{{#set:Has number=.1;.01;.001;.00001;4.0e-4;.2e-5;.3e5|+sep=; }}"
},
{
"page": "Example/P0208/3",
"contents": "{{#set:Has number=-.1;-0.2;-.2e-5;-.3e5|+sep=; }}"
},
{
"page": "Example/P0208/1/1",
"contents": "{{#ask: [[Example/P0208/1]] |?Has number |format=table }}"
},
{
"page": "Example/P0208/1/2",
"contents": "{{#ask: [[Example/P0208/1]] |?Has number# |format=table }}"
},
{
"page": "Example/P0208/2/1",
"contents": "{{#ask: [[Example/P0208/2]] |?Has number |format=table }}"
},
{
"page": "Example/P0208/2/2",
"contents": "{{#ask: [[Example/P0208/2]] |?Has number# |format=table }}"
},
{
"page": "Example/P0208/3/1",
"contents": "{{#ask: [[Example/P0208/3]] |?Has number |format=table }}"
}
],
"tests": [
{
"type": "parser",
"about": "#0",
"subject": "Example/P0208/1",
"store": {
"clear-cache": true
},
"assert-store": {
"semantic-data": {
"strictPropertyValueMatch": false,
"propertyCount": 3,
"propertyKeys": [
"Has_number",
"_SKEY",
"_MDAT"
],
"propertyValues": [
"2,000",
"10,000",
"300",
"40",
"0",
"0.1",
"0.01",
"0.001",
"1.0e-4",
"0.02",
"0.003",
"4.0e-4",
"5.0e-5",
"42,973,100,000"
]
}
}
},
{
"type": "parser",
"about": "#1",
"subject": "Example/P0208/2",
"store": {
"clear-cache": true
},
"assert-store": {
"semantic-data": {
"strictPropertyValueMatch": false,
"propertyCount": 3,
"propertyKeys": [
"Has_number",
"_SKEY",
"_MDAT"
],
"propertyValues": [
"0.1",
"0.01",
"0.001",
"1.0e-5",
"4.0e-4",
"2.0e-6",
"30000"
]
}
}
},
{
"type": "parser",
"about": "#2 #ask number output",
"subject": "Example/P0208/1/1",
"assert-output": {
"to-contain": [
"2,000",
"10,000",
"300",
"40",
"0",
"0.1",
"0.01",
"0.001",
"1.0e-4",
"0.02",
"0.003",
"4.0e-4",
"5.0e-5",
"42,973,100,000"
]
}
},
{
"type": "parser",
"about": "#3 #ask plain number output",
"subject": "Example/P0208/1/2",
"assert-output": {
"to-contain": [
"2000",
"10000",
"300",
"40",
"0",
"0.1",
"0.01",
"0.001",
"0.0001",
"0.02",
"0.003",
"0.0004",
"5.0e-5",
"42973100000"
]
}
},
{
"type": "parser",
"about": "#4 #ask number output (non leading zero)",
"subject": "Example/P0208/2/1",
"assert-output": {
"to-contain": [
"0.1",
"0.01",
"0.001",
"1.0e-5",
"4.0e-4",
"2.0e-6",
"30,000"
]
}
},
{
"type": "parser",
"about": "#5 #ask plain number output (non leading zero)",
"subject": "Example/P0208/2/2",
"assert-output": {
"to-contain": [
"0.1",
"0.01",
"0.001",
"1.0e-5",
"0.0004",
"2.0e-6",
"30000"
]
}
},
{
"type": "parser",
"about": "#6 on negative use",
"subject": "Example/P0208/3",
"store": {
"clear-cache": true
},
"assert-store": {
"semantic-data": {
"strictPropertyValueMatch": false,
"propertyCount": 3,
"propertyKeys": [
"Has_number",
"_SKEY",
"_MDAT"
],
"propertyValues": [
"-30000",
"-2.0e-6",
"-0.2",
"-0.1"
]
}
}
},
{
"type": "parser",
"about": "#7 #ask on negative number output",
"subject": "Example/P0208/3/1",
"assert-output": {
"to-contain": [
"-30,000",
"-2.0e-6",
"-0.2",
"-0.1"
]
}
}
],
"settings": {
"wgContLang": "en",
"wgLang": "en",
"smwgMaxNonExpNumber": 1.0e+15,
"smwgPageSpecialProperties": [
"_MDAT"
]
},
"meta": {
"version": "2",
"is-incomplete": false,
"debug": false
}
}