It seems that the mode format returns how many times the mode appears, not the actual mode itself
|
$array_counted_values = array_count_values( $array_temp ); |
|
$max = max( $array_counted_values ); |
array_count_values gives counts as values, and max gets the max value, meaning
$max is a count, not the most common property value
It seems the unit test even expects the count instead of the actual mode
|
"about": "#18 format=mode", |
|
"subject": "Example/Math/Q.19", |
|
"assert-output": { |
|
"to-contain": [ |
|
"1" |
|
"page": "Example/Math/Q.19", |
|
"contents": "{{#show: Example/Math/2 |?Has number|format=mode }}" |
|
"page": "Example/Math/2", |
|
"contents": "[[Has number::333]]" |
The mode should be 333, the only number, but instead it expects and gets how many times 333 occurs
It seems that the mode format returns how many times the mode appears, not the actual mode itself
SemanticResultFormats/formats/math/SRF_Math.php
Line 187 in 42c2690
SemanticResultFormats/formats/math/SRF_Math.php
Line 189 in 42c2690
SemanticResultFormats/formats/math/SRF_Math.php
Line 201 in 42c2690
array_count_valuesgives counts as values, and max gets the max value, meaning$maxis a count, not the most common property valueIt seems the unit test even expects the count instead of the actual mode
SemanticResultFormats/tests/phpunit/Integration/JSONScript/TestCases/math-01.json
Lines 309 to 313 in 42c2690
SemanticResultFormats/tests/phpunit/Integration/JSONScript/TestCases/math-01.json
Lines 94 to 95 in 42c2690
SemanticResultFormats/tests/phpunit/Integration/JSONScript/TestCases/math-01.json
Lines 14 to 15 in 42c2690
The mode should be 333, the only number, but instead it expects and gets how many times 333 occurs