1 /* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // -------------------------------------------------------------------------*/
11 #include "sjme/list.h"
15 /** Test argument count. */
16 static const sjme_jint testArgC
= 4;
18 /** Test argv values. */
19 static sjme_lpcstr testArgV
[4] = {
27 * Tests flattening of argc/argv.
31 SJME_TEST_DECLARE(testListFlattenArgs
)
33 sjme_list_sjme_lpcstr
* list
;
36 /* Test array load of list. */
38 if (sjme_error_is(sjme_list_flattenArgCV(test
->pool
,
39 (sjme_list_sjme_lpstr
**)&list
,
40 testArgC
, testArgV
)) || list
== NULL
)
41 sjme_unit_fail(test
, "Could not build flattened list?");
43 /* Test resultant list values. */
44 sjme_unit_equalI(test
, list
->length
, testArgC
, "Length invalid?");
45 for (i
= 0; i
< testArgC
; i
++)
47 /* The strings should be equal. */
48 sjme_unit_equalS(test
, list
->elements
[i
], testArgV
[i
],
49 "Array element %d not set correctly?", i
);
51 /* However the pointers should not be the same, as it is a copy. */
52 sjme_unit_notEqualP(test
, list
->elements
[i
], testArgV
[i
],
53 "Value element %d was not copied?", i
);
57 return SJME_TEST_RESULT_PASS
;