Simplified doc-site generation
[AGL/documentation.git] / docs / 4_APIs_and_Services / 4.4_AGL_Test_Framework / 5_Reference / 4_LuaUnit_Assertion_Functions / 0_General_Assertions.md
1 ---
2 edit_link: ''
3 title: General Assertions
4 origin_url: >-
5   https://git.automotivelinux.org/apps/app-afb-test/plain/docs/Reference/LuaUnitAssertionFunctions/0_GeneralAssertions.md?h=master
6 ---
7
8 <!-- WARNING: This file is generated by fetch_docs.js using /home/boron/Documents/AGL/docs-webtemplate/site/_data/tocs/apis_services/master/app-afb-test-developer-guides-api-services-book.yml -->
9
10 # General Assertions
11
12 * **_AFT.assertEquals(actual, expected)**
13
14     Assert that two values are equal.
15
16     For tables, the comparison is a deep comparison :
17
18   * number of elements must be the same
19   * tables must contain the same keys
20   * each key must contain the same values. The values are also compared recursively with deep comparison.
21
22     LuaUnit provides other table-related assertions, see [Table assertions](http://luaunit.readthedocs.io/en/luaunit_v3_2_1/#assert-table)
23
24 * **_AFT.assertNotEquals(actual, expected)**
25
26     Assert that two values are different. The assertion fails if the two values are identical.
27
28     It also uses table deep comparison.
29
30 * **_AFT.assertAlmostEquals(actual, expected, margin)**
31
32     Assert that two floating point numbers are almost equal.
33
34     When comparing floating point numbers, strict equality does not work.
35     Computer arithmetic is so that an operation that mathematically yields
36     1.00000000 might yield 0.999999999999 in lua . That’s why you need an
37     almost equals comparison, where you specify the error margin.
38
39 * **_AFT.assertNotAlmostEquals(actual, expected, margin)**
40
41     Assert that two floating point numbers are not almost equal.