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 &list
, testArgC
, testArgV
)) || list
== NULL
)
40 sjme_unit_fail(test
, "Could not build flattened list?");
42 /* Test resultant list values. */
43 sjme_unit_equalI(test
, list
->length
, testArgC
, "Length invalid?");
44 for (i
= 0; i
< testArgC
; i
++)
46 /* The strings should be equal. */
47 sjme_unit_equalS(test
, list
->elements
[i
], testArgV
[i
],
48 "Array element %d not set correctly?", i
);
50 /* However the pointers should not be the same, as it is a copy. */
51 sjme_unit_notEqualP(test
, list
->elements
[i
], testArgV
[i
],
52 "Value element %d was not copied?", i
);
56 return SJME_TEST_RESULT_PASS
;