Pass -XstartOnFirstThread for the JVM on macOS.
[SquirrelJME.git] / nanocoat / tests / testListFlattenArgs.c
blob43a782c63be4b815bc69ded87ef6ca92b0668ced
1 /* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // SquirrelJME
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 // -------------------------------------------------------------------------*/
10 #include "proto.h"
11 #include "sjme/list.h"
12 #include "test.h"
13 #include "unit.h"
15 /** Test argument count. */
16 static const sjme_jint testArgC = 4;
18 /** Test argv values. */
19 static sjme_lpcstr testArgV[4] = {
20 "squirrels",
21 "are",
22 "so",
23 "cute!"
26 /**
27 * Tests flattening of argc/argv.
29 * @since 2023/12/17
31 SJME_TEST_DECLARE(testListFlattenArgs)
33 sjme_list_sjme_lpcstr* list;
34 sjme_jint i;
36 /* Test array load of list. */
37 list = NULL;
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);
56 /* Success! */
57 return SJME_TEST_RESULT_PASS;