Simplified doc-site generation
[AGL/documentation.git] / docs / 4_APIs_and_Services / 4.4_AGL_Test_Framework / 5_Reference / 4_LuaUnit_Assertion_Functions / 6_Table_Assertions.md
1 ---
2 edit_link: ''
3 title: Table Assertions
4 origin_url: >-
5   https://git.automotivelinux.org/apps/app-afb-test/plain/docs/Reference/LuaUnitAssertionFunctions/6_TableAssertions.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 # Table assertions
11
12 * **_AFT.assertItemsEquals(actual, expected)**
13
14     Assert that two tables contain the same items, irrespective of their keys.
15
16     This function is practical for example if you want to compare two lists but
17     where items are not in the same order:
18
19 ```lua
20     luaunit.assertItemsEquals( {1,2,3}, {3,2,1} ) -- assertion succeeds
21 ```
22     The comparison is not recursive on the items: if any of the items are tables,
23     they are compared using table equality (like as in assertEquals() ), where the
24     key matters.
25
26 ```lua
27     luaunit.assertItemsEquals( {1,{2,3},4}, {4,{3,2,},1} ) -- assertion fails because {2,3} ~= {3,2}
28 ```