| 1 | -module(hope_list_SUITE). |
| 2 | |
| 3 | %% Callbacks |
| 4 | -export( |
| 5 | [ all/0 |
| 6 | , groups/0 |
| 7 | ]). |
| 8 | |
| 9 | %% Test cases |
| 10 | -export( |
| 11 | [ t_unique_preserve_order/1 |
| 12 | ]). |
| 13 | |
| 14 | |
| 15 | -define(GROUP , hope_list). |
| 16 | |
| 17 | |
| 18 | %% ============================================================================ |
| 19 | %% Common Test callbacks |
| 20 | %% ============================================================================ |
| 21 | |
| 22 | all() -> |
| 23 | [{group, ?GROUP}]. |
| 24 | |
| 25 | groups() -> |
| 26 | Tests = |
| 27 | [ t_unique_preserve_order |
| 28 | ], |
| 29 | Properties = [], |
| 30 | [{?GROUP, Properties, Tests}]. |
| 31 | |
| 32 | |
| 33 | %% ============================================================================= |
| 34 | %% Test cases |
| 35 | %% ============================================================================= |
| 36 | |
| 37 | t_unique_preserve_order(_Cfg) -> |
| 38 | ListAGiven = [a, a, g, b, f, c, a, d, a, e, f, d], |
| 39 | ListBGiven = "australia", |
| 40 | ListAExpected = [a, g, b, f, c, d, e], |
| 41 | ListBExpected = "austrli", |
| 42 | ListAComputed = hope_list:unique_preserve_order(ListAGiven), |
| 43 | ListBComputed = hope_list:unique_preserve_order(ListBGiven), |
| 44 | ListAComputed = ListAExpected, |
| 45 | ListBComputed = ListBExpected. |