X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=docs%2F4_APIs_and_Services%2F4.4_AGL_Test_Framework%2F5_Reference%2F4_LuaUnit_Assertion_Functions%2F0_General_Assertions.md;fp=docs%2F4_APIs_and_Services%2F4.4_AGL_Test_Framework%2F5_Reference%2F4_LuaUnit_Assertion_Functions%2F0_General_Assertions.md;h=a66939ba110124b9d254aee81672fc6229c71050;hb=4aad369c9728061c97b3de792286e743ee884b09;hp=0000000000000000000000000000000000000000;hpb=619a7e48085be1538c3b01eb93dcb9dc95bf0436;p=AGL%2Fdocumentation.git diff --git a/docs/4_APIs_and_Services/4.4_AGL_Test_Framework/5_Reference/4_LuaUnit_Assertion_Functions/0_General_Assertions.md b/docs/4_APIs_and_Services/4.4_AGL_Test_Framework/5_Reference/4_LuaUnit_Assertion_Functions/0_General_Assertions.md new file mode 100644 index 0000000..a66939b --- /dev/null +++ b/docs/4_APIs_and_Services/4.4_AGL_Test_Framework/5_Reference/4_LuaUnit_Assertion_Functions/0_General_Assertions.md @@ -0,0 +1,41 @@ +--- +edit_link: '' +title: General Assertions +origin_url: >- + https://git.automotivelinux.org/apps/app-afb-test/plain/docs/Reference/LuaUnitAssertionFunctions/0_GeneralAssertions.md?h=master +--- + + + +# General Assertions + +* **_AFT.assertEquals(actual, expected)** + + Assert that two values are equal. + + For tables, the comparison is a deep comparison : + + * number of elements must be the same + * tables must contain the same keys + * each key must contain the same values. The values are also compared recursively with deep comparison. + + LuaUnit provides other table-related assertions, see [Table assertions](http://luaunit.readthedocs.io/en/luaunit_v3_2_1/#assert-table) + +* **_AFT.assertNotEquals(actual, expected)** + + Assert that two values are different. The assertion fails if the two values are identical. + + It also uses table deep comparison. + +* **_AFT.assertAlmostEquals(actual, expected, margin)** + + Assert that two floating point numbers are almost equal. + + When comparing floating point numbers, strict equality does not work. + Computer arithmetic is so that an operation that mathematically yields + 1.00000000 might yield 0.999999999999 in lua . That’s why you need an + almost equals comparison, where you specify the error margin. + +* **_AFT.assertNotAlmostEquals(actual, expected, margin)** + + Assert that two floating point numbers are not almost equal. \ No newline at end of file