Serene Runtime 1.0.0
C runtime for the Serene programming language
Loading...
Searching...
No Matches
base.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/rt/context.h>
22#include <serene/rt/engine.h>
24#include <serene/utils.h>
25
26#include "acutest.h"
27
28#define ENTRY(name, test) {name, test}
29
30#define ASSERT_NOT_NULL(x) TEST_ASSERT(x != nullptr)
31
32#define MAKE_ENGINE(mm, engine) \
33 srn_mm_t *mm = srn_mm_init(); \
34 TEST_ASSERT(mm != nullptr); \
35 srn_engine_t *engine = srn_engine_make(mm); \
36 TEST_ASSERT(engine != nullptr)
37
38#define SHUTDOWN_ENGINE(mm, engine) \
39 srn_engine_shutdown(engine); \
40 srn_mm_shutdown(mm)
41
42#define MAKE_CONTEXT(engine, x) \
43 srn_context_t *x = srn_context_make(engine); \
44 TEST_ASSERT(x != nullptr)
45
46#define RELEASE_CONTEXT(x) srn_context_release(x);