Add tests for copied values.

This commit is contained in:
Tom Alexander 2020-05-16 14:48:04 -04:00
parent 6dbeb77a28
commit d751df6fd5
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
7 changed files with 162 additions and 2 deletions

View File

@ -8,3 +8,8 @@ Can't Walk Theory
Assuming a missing value = cantwalk and a non-existent key = cantwalk then their equality makes sense.
The null tests have proven that absent parameters and missing values do not equal null and therefore it is not just making all falsey values equal.
Non-Scalar Values
-----------------
For non-scalar values, it seems that dust does mark two values as true if they have the same path, but otherwise they are not equal.

View File

@ -4,13 +4,57 @@
"alpha": 21,
"beta": "21",
"null": null,
"true_value": true,
"false_value": false,
"array_lower": [
3,
5,
7
],
"copy_array_lower": [
3,
5,
7
],
"array_higher": [
8,
9
],
"some_obj": {
"name": "cat"
},
"copy_some_obj": {
"name": "cat"
},
"other_obj": {
"name": "dog"
},
"array_of_some_obj": [
{
"name": "cat"
},
{
"name": "cat"
}
],
"copy_array_of_some_obj": [
{
"name": "cat"
},
{
"name": "cat"
}
],
"array_of_other_obj": [
{
"name": "dog"
},
{
"name": "dog"
}
],
"array_of_strings": [
"cat",
"dog"
]
}

View File

@ -17,4 +17,12 @@ beta is {beta}{~n}
{@eq key=null value=gamma}null equals a non-existent value{:else}null does not equal a non-existent value{/eq}{~n}
{@eq}no parameters is true{:else}no parameters is false{/eq}{~n}
{@eq key=array_lower value=array_higher}[3,5,7] is equal to [8,9]{:else}[3,5,7] does not equal [8,9]{/eq}{~n}
{@eq key=array_lower value=array_lower}[3,5,7] is equal to [3,5,7]{:else}[3,5,7] does not equal [3,5,7]{/eq}{~n}
{! non-scalar and copied value tests !}
{@eq key=array_lower value=array_lower}array_lower is equal to array_lower{:else}array_lower does not equal array_lower{/eq}{~n}
{@eq key=array_lower value=copy_array_lower}array_lower is equal to copy_array_lower{:else}array_lower does not equal copy_array_lower{/eq}{~n}
{@eq key=some_obj value=some_obj}some_obj is equal to some_obj{:else}some_obj does not equal some_obj{/eq}{~n}
{@eq key=some_obj value=copy_some_obj}some_obj is equal to copy_some_obj{:else}some_obj does not equal copy_some_obj{/eq}{~n}
{@eq key=some_obj value=other_obj}some_obj is equal to other_obj{:else}some_obj does not equal other_obj{/eq}{~n}
{@eq key=array_of_some_obj value=array_of_some_obj}array_of_some_obj is equal to array_of_some_obj{:else}array_of_some_obj does not equal array_of_some_obj{/eq}{~n}
{@eq key=array_of_some_obj value=copy_array_of_some_obj}array_of_some_obj is equal to copy_array_of_some_obj{:else}array_of_some_obj does not equal copy_array_of_some_obj{/eq}{~n}
{@eq key=array_of_some_obj value=array_of_other_obj}array_of_some_obj is equal to array_of_other_obj{:else}array_of_some_obj does not equal array_of_other_obj{/eq}{~n}

View File

@ -11,8 +11,50 @@
5,
7
],
"copy_array_lower": [
3,
5,
7
],
"array_higher": [
8,
9
],
"some_obj": {
"name": "cat"
},
"copy_some_obj": {
"name": "cat"
},
"other_obj": {
"name": "dog"
},
"array_of_some_obj": [
{
"name": "cat"
},
{
"name": "cat"
}
],
"copy_array_of_some_obj": [
{
"name": "cat"
},
{
"name": "cat"
}
],
"array_of_other_obj": [
{
"name": "dog"
},
{
"name": "dog"
}
],
"array_of_strings": [
"cat",
"dog"
]
}

View File

@ -24,3 +24,12 @@ beta is {beta}{~n}
{@gt key=true_value value=false_value}true is greater than false{:else}true is less than or equal to false{/gt}{~n}
{@gt key=array_lower value=array_higher}[3,5,7] is greater than [8,9]{:else}[3,5,7] is less than or equal to [8,9]{/gt}{~n}
{@gt key=array_higher value=array_lower}[8,9] is greater than [3,5,7]{:else}[8,9] is less than or equal to [3,5,7]{/gt}{~n}
{! non-scalar and copied value tests !}
{@gt key=array_lower value=array_lower}array_lower is greater than array_lower{:else}array_lower is less than or equal to array_lower{/gt}{~n}
{@gt key=array_lower value=copy_array_lower}array_lower is greater than copy_array_lower{:else}array_lower is less than or equal to copy_array_lower{/gt}{~n}
{@gt key=some_obj value=some_obj}some_obj is greater than some_obj{:else}some_obj is less than or equal to some_obj{/gt}{~n}
{@gt key=some_obj value=copy_some_obj}some_obj is greater than copy_some_obj{:else}some_obj is less than or equal to copy_some_obj{/gt}{~n}
{@gt key=some_obj value=other_obj}some_obj is greater than other_obj{:else}some_obj is less than or equal to other_obj{/gt}{~n}
{@gt key=array_of_some_obj value=array_of_some_obj}array_of_some_obj is greater than array_of_some_obj{:else}array_of_some_obj is less than or equal to array_of_some_obj{/gt}{~n}
{@gt key=array_of_some_obj value=copy_array_of_some_obj}array_of_some_obj is greater than copy_array_of_some_obj{:else}array_of_some_obj is less than or equal to copy_array_of_some_obj{/gt}{~n}
{@gt key=array_of_some_obj value=array_of_other_obj}array_of_some_obj is greater than array_of_other_obj{:else}array_of_some_obj is less than or equal to array_of_other_obj{/gt}{~n}

View File

@ -4,13 +4,57 @@
"alpha": 21,
"beta": "21",
"null": null,
"true_value": true,
"false_value": false,
"array_lower": [
3,
5,
7
],
"copy_array_lower": [
3,
5,
7
],
"array_higher": [
8,
9
],
"some_obj": {
"name": "cat"
},
"copy_some_obj": {
"name": "cat"
},
"other_obj": {
"name": "dog"
},
"array_of_some_obj": [
{
"name": "cat"
},
{
"name": "cat"
}
],
"copy_array_of_some_obj": [
{
"name": "cat"
},
{
"name": "cat"
}
],
"array_of_other_obj": [
{
"name": "dog"
},
{
"name": "dog"
}
],
"array_of_strings": [
"cat",
"dog"
]
}

View File

@ -17,4 +17,12 @@ beta is {beta}{~n}
{@ne key=null value=gamma}null does not equal non-existent value{:else}null equals a non-existent value{/ne}{~n}
{@ne}no parameters is true{:else}no parameters is false{/ne}{~n}
{@ne key=array_lower value=array_higher}[3,5,7] does not equal [8,9]{:else}[3,5,7] is equal to [8,9]{/ne}{~n}
{@ne key=array_lower value=array_lower}[3,5,7] does not equal [3,5,7]{:else}[3,5,7] is equal to [3,5,7]{/ne}{~n}
{! non-scalar and copied value tests !}
{@ne key=array_lower value=array_lower}array_lower does not equal array_lower{:else}array_lower is equals to array_lower{/ne}{~n}
{@ne key=array_lower value=copy_array_lower}array_lower does not equal copy_array_lower{:else}array_lower is equals to copy_array_lower{/ne}{~n}
{@ne key=some_obj value=some_obj}some_obj does not equal some_obj{:else}some_obj is equals to some_obj{/ne}{~n}
{@ne key=some_obj value=copy_some_obj}some_obj does not equal copy_some_obj{:else}some_obj is equals to copy_some_obj{/ne}{~n}
{@ne key=some_obj value=other_obj}some_obj does not equal other_obj{:else}some_obj is equals to other_obj{/ne}{~n}
{@ne key=array_of_some_obj value=array_of_some_obj}array_of_some_obj does not equal array_of_some_obj{:else}array_of_some_obj is equals to array_of_some_obj{/ne}{~n}
{@ne key=array_of_some_obj value=copy_array_of_some_obj}array_of_some_obj does not equal copy_array_of_some_obj{:else}array_of_some_obj is equals to copy_array_of_some_obj{/ne}{~n}
{@ne key=array_of_some_obj value=array_of_other_obj}array_of_some_obj does not equal array_of_other_obj{:else}array_of_some_obj is equals to array_of_other_obj{/ne}{~n}