steveosoule
5/18/2017 - 10:45 PM

JSON Value Validate Numeric - Test Cases

JSON Value Validate Numeric - Test Cases

<mvt:assign name="l.settings:custom_tests" value="miva_array_deserialize('-0,-0.333,-0.333e+333,-0.333e-333,-0.333E+333,-0.333E-333,-100,-100.333,-100.333e+333,-100.333e-333,-100.333E+333,-100.333E-333,-0,-0.333,-0.333e+333,-0.333e-333,-0.333E+333,-0.333E-333,-100e+333,-100e-333,-100E+333,-100E-333,0,0.333,0.333e+333,0.333e-333,0.333E+333,0.333E-333,100,100.333,100.333e+332,100.333e-333,100.333E+333,100.333E-333,0,0.333,0.333e+333,0.333e-333,0.333E+333,0.333E-333,100e+333,100e-333,100E+333,100E-333,333,333.333,-2,-1.5,-1,-0.5,0,000.000,0.5,1,1.5,2,3.14159,111111111,000000-,-,!,@,#,$,%,^,a,b,c,d,-1.b,u.3')" />
<mvt:foreach iterator="string" array="custom_tests">
	<mvt:do file="g.Module_Root $ g.Module_Path $ 'util/sgs_developer_utilities.mvc'" name="l.result" value="JSON_Value_Is_Numeric( l.settings:string )" />

	<mvt:if expr="l.result">
		<mvt:assign name="l.settings:color" value="'green'" />
		<mvt:assign name="l.settings:result" value="'PASS'" />
	<mvt:else>
		<mvt:assign name="l.settings:color" value="'red'" />
		<mvt:assign name="l.settings:result" value="'FAIL'" />
	</mvt:if>

	<h4 style="color: &mvt:color;"><code>&mvt:result;: "&mvte:string;"</code></h4>

</mvt:foreach>

<hr>

<mvt:assign name="l.settings:l.settings:naughty_string:miva_json_decode_result" value="miva_json_decode( l.settings:naughty_string:json, l.settings:naughty_string:data )" />
<mvt:call action="'https://cdn.rawgit.com/minimaxir/big-list-of-naughty-strings/master/blns.json'" method="'GET'">
	<mvt:assign name="l.settings:naughty_string:json" value="l.settings:naughty_string:json $ s.callvalue"/>
</mvt:call>
<mvt:assign name="l.settings:naughty_string:miva_json_decode_result" value="miva_json_decode( l.settings:naughty_string:json, l.settings:naughty_string:data )" />

<mvt:foreach iterator="string" array="naughty_string:data">
	<mvt:do file="g.Module_Root $ g.Module_Path $ 'util/sgs_developer_utilities.mvc'" name="l.result" value="JSON_Value_Is_Numeric( l.settings:string )" />

	<mvt:if expr="l.result">
		<mvt:assign name="l.settings:color" value="'green'" />
		<mvt:assign name="l.settings:result" value="'PASS'" />
	<mvt:else>
		<mvt:assign name="l.settings:color" value="'red'" />
		<mvt:assign name="l.settings:result" value="'FAIL'" />
	</mvt:if>

	<h4 style="color: &mvt:color;"><code>&mvt:result;: "&mvte:string;"</code></h4>

</mvt:foreach>