Serene Runtime 1.0.0
C runtime for the Serene programming language
Loading...
Searching...
No Matches
gc_tests.h
Go to the documentation of this file.
1/* -*- C -*-
2 * Serene programming language
3 * Copyright (C) 2019-2026 Sameer Rahmani <[email protected]>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
19#pragma once
20
21#include <serene/gc/gc.h>
22#include <serene/rt/context.h>
23
24#include "base.h"
25
26#define GC_TESTS(X) X("gc::allocation", test_gc_allocation)
27
28typedef struct gc_dummy {
29 char *foo;
30 int bar;
32
33static void test_gc_allocation() {
34 MAKE_CONTEXT(ctx);
35
36 gc_dummy *d = (gc_dummy *)ctx->gc->alloc(sizeof(gc_dummy));
37 TEST_CHECK(d != nullptr);
38 srn_shutdown_context(ctx);
39}
#define TEST_CHECK(cond)
Definition acutest.h:96
#define MAKE_CONTEXT(engine, x)
Definition base.h:42
static void test_gc_allocation()
Definition gc_tests.h:33
int bar
Definition gc_tests.h:30
char * foo
Definition gc_tests.h:29