Add tests for `ifstricteq`, `ifstrictne`, and `strictequals`.

This commit is contained in:
David Wendt 2020-03-08 23:12:52 -04:00
parent 34ab8c8ce6
commit 6117288fe2
13 changed files with 252 additions and 0 deletions

View File

@ -255,6 +255,9 @@ swf_tests! {
(as3_object_value_of, "avm2/object_value_of", 1),
(as3_function_value_of, "avm2/function_value_of", 1),
(as3_class_value_of, "avm2/class_value_of", 1),
(as3_if_stricteq, "avm2/if_stricteq", 1),
(as3_if_strictne, "avm2/if_strictne", 1),
(as3_strict_equality, "avm2/strict_equality", 1),
}
// TODO: These tests have some inaccuracies currently, so we use approx_eq to test that numeric values are close enough.

View File

@ -0,0 +1,72 @@
package {
public class Test {}
}
if(2 === "2")
{
trace("ERROR: 2 === \"2\"");
}
if(2 === 2)
{
trace("2 === 2");
}
if(2 === 5)
{
trace("ERROR: 2 === 5");
}
if(true === true)
{
trace("true === true");
}
if(false === false)
{
trace("false === false");
}
if(true === false)
{
trace("ERROR: true === false");
}
if(1 === true)
{
trace("ERROR: 1 === true");
}
if(0 === false)
{
trace("ERROR: 0 === false");
}
if("abc" === "abc")
{
trace("\"abc\" === \"abc\"");
}
if(0 === undefined)
{
trace("ERROR: 0 === undefined");
}
if(undefined === undefined)
{
trace("undefined === undefined");
}
if(NaN === NaN)
{
trace("NaN === NaN");
}
if(undefined === NaN)
{
trace("ERROR: undefined === NaN");
}
if(0 === null)
{
trace("ERROR: 0 === null");
}
if(null === null)
{
trace("null === null");
}
if(undefined === null)
{
trace("ERROR: undefined === null");
}
if(NaN === null)
{
trace("ERROR: NaN === null");
}

View File

@ -0,0 +1,6 @@
2 === 2
true === true
false === false
"abc" === "abc"
undefined === undefined
null === null

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,72 @@
package {
public class Test {}
}
if(2 !== "2")
{
trace("2 !== \"2\"");
}
if(2 !== 2)
{
trace("ERROR: 2 !== 2");
}
if(2 !== 5)
{
trace("2 !== 5");
}
if(true !== true)
{
trace("ERROR: true !== true");
}
if(false !== false)
{
trace("ERROR: false !== false");
}
if(true !== false)
{
trace("true !== false");
}
if(1 !== true)
{
trace("1 !== true");
}
if(0 !== false)
{
trace("0 !== false");
}
if("abc" !== "abc")
{
trace("ERROR: \"abc\" !== \"abc\"");
}
if(0 !== undefined)
{
trace("0 !== undefined");
}
if(undefined !== undefined)
{
trace("ERROR: undefined !== undefined");
}
if(NaN !== NaN)
{
trace("NaN !== NaN");
}
if(undefined !== NaN)
{
trace("undefined !== NaN");
}
if(0 !== null)
{
trace("0 !== null");
}
if(null !== null)
{
trace("ERROR: null !== null");
}
if(undefined !== null)
{
trace("undefined !== null");
}
if(NaN !== null)
{
trace("NaN !== null");
}

View File

@ -0,0 +1,11 @@
2 !== "2"
2 !== 5
true !== false
1 !== true
0 !== false
0 !== undefined
NaN !== NaN
undefined !== NaN
0 !== null
undefined !== null
NaN !== null

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,54 @@
package {
public class Test {}
}
trace("//2 === \"2\"");
trace(2 === "2");
trace("//2 === 2");
trace(2 === 2);
trace("//2 === 5");
trace(2 === 5);
trace("//true === true");
trace(true === true);
trace("//false === false");
trace(false === false);
trace("//true === false");
trace(true === false);
trace("//1 === true");
trace(1 === true);
trace("//0 === false");
trace(0 === false);
trace("//\"abc\" === \"abc\"");
trace("abc" === "abc");
trace("//0 === undefined");
trace(0 === undefined);
trace("//undefined === undefined");
trace(undefined === undefined);
trace("//NaN === NaN");
trace(NaN === NaN);
trace("//undefined === NaN");
trace(undefined === NaN);
trace("//0 === null");
trace(0 === null);
trace("//null === null");
trace(null === null);
trace("//undefined === null");
trace(undefined === null);
trace("//NaN === null");
trace(NaN === null);

View File

@ -0,0 +1,34 @@
//2 === "2"
false
//2 === 2
true
//2 === 5
false
//true === true
true
//false === false
true
//true === false
false
//1 === true
false
//0 === false
false
//"abc" === "abc"
true
//0 === undefined
false
//undefined === undefined
true
//NaN === NaN
false
//undefined === NaN
false
//0 === null
false
//null === null
true
//undefined === null
false
//NaN === null
false

Binary file not shown.

Binary file not shown.