Increase inflation traverse extra node size; Handling of method code.
[SquirrelJME.git] / nanocoat / tests / testAllocWeakRefNonWeak.c
blobdd66c69b7b4396f2c167d8de69214694105cffa9
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 "test.h"
11 #include "proto.h"
12 #include "mock.h"
13 #include "unit.h"
15 #include "sjme/alloc.h"
17 /**
18 * Tests referencing a non-weak pointer.
20 * @since 2024/07/08
22 SJME_TEST_DECLARE(testAllocWeakRefNonWeak)
24 sjme_errorCode error;
25 sjme_alloc_weak weak;
26 sjme_pointer p;
28 /* Allocate. */
29 p = NULL;
30 if (sjme_error_is(sjme_alloc(test->pool, 512, &p)) || p == NULL)
31 return sjme_unit_fail(test, "Could not allocate block?");
33 /* Create weak reference, fails because not weak. */
34 weak = NULL;
35 error = sjme_alloc_weakRefE(p, &weak,
36 NULL, NULL);
38 /* Test conditions. */
39 sjme_unit_equalP(test, weak, NULL,
40 "A weak pointer was allocated?");
41 sjme_unit_equalI(test, error, SJME_ERROR_NOT_WEAK_REFERENCE,
42 "Incorrect error was set?");
44 /* Success! */
45 return SJME_TEST_RESULT_PASS;