Serene Runtime
1.0.0-dev
C runtime for the Serene programming language
Loading...
Searching...
No Matches
main.c
Go to the documentation of this file.
1
/* -*- C -*-
2
* Serene programming language
3
* Copyright (C) 2019-2026 Sameer Rahmani <lxsameer@lxsameer.com>
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
// Uncomment only if you want to run a debugger on the tests binary
20
#define TEST_NO_FORK
21
22
#if !defined(_WIN32)
23
# ifndef _POSIX_C_SOURCE
24
# define _POSIX_C_SOURCE 200809L
25
# endif
26
#endif
27
28
#include "
array_list_tests.h
"
29
#include "
base.h
"
30
#include "
fiber/mutex_tests.h
"
31
#include "
fiber_tests.h
"
32
#include "
hashmap_tests.h
"
33
#include "
mm_tests.h
"
34
#include "
pqmh_tests.h
"
35
#include "
reactor_io_tests.h
"
36
#include "
reactor_tests.h
"
37
#include "
seq_tests.h
"
38
#include "
source_manager_tests.h
"
39
#include "
spsc_ring_tests.h
"
40
41
// The value model and its dependents are only built with the Serene layer, so
42
// their tests are too.
43
#ifdef SRN_WITH_SERENE
44
# include "
context_tests.h
"
45
# include "
ns_tests.h
"
46
# include "
reader_tests.h
"
47
# include "
symbol_tests.h
"
48
# include "
value_tests.h
"
49
#endif
50
51
#if defined(SERENE_TESTS)
52
hmap_hash_t
hmap_hash
(
const
srn_context_t
*ctx,
const
void
*k,
size_t
len
) {
53
(void)ctx;
54
if
(k ==
nullptr
||
len
== 0) {
55
return
1;
56
}
57
58
const
uint8_t *p = (
const
uint8_t *)k;
59
// Very high collision rate. Only 256 possible hashes
60
return
(uint32_t)p[0];
61
}
62
#endif
63
64
TEST_LIST
= {
65
MM_TESTS
(
ENTRY
),
66
FIBER_TESTS
(
ENTRY
),
67
MUTEX_TESTS
(
ENTRY
),
68
SEQ_TESTS
(
ENTRY
),
69
AL_TESTS
(
ENTRY
),
70
SM_TESTS
(
ENTRY
),
71
HMAP_TESTS
(
ENTRY
),
72
SPSC_RING_TESTS
(
ENTRY
),
73
PQMH_TESTS
(
ENTRY
),
74
REACTOR_TESTS
(
ENTRY
),
75
#ifdef __linux__
76
REACTOR_IO_TESTS(
ENTRY
),
77
#endif
78
79
#ifdef SRN_WITH_SERENE
80
CTX_TESTS
(
ENTRY
),
81
NS_TESTS
(
ENTRY
),
82
SYMBOL_TESTS
(
ENTRY
),
83
VALUE_TESTS
(
ENTRY
)
READER_TESTS
(
ENTRY
),
84
#endif
85
{NULL, NULL},
86
};
TEST_LIST
#define TEST_LIST
Definition
acutest.h:73
array_list_tests.h
AL_TESTS
#define AL_TESTS(X)
Definition
array_list_tests.h:28
base.h
ENTRY
#define ENTRY(name, test)
Definition
base.h:28
context_tests.h
CTX_TESTS
#define CTX_TESTS(X)
Definition
context_tests.h:26
fiber_tests.h
FIBER_TESTS
#define FIBER_TESTS(X)
Definition
fiber_tests.h:30
hmap_hash
hmap_hash_t hmap_hash(const srn_context_t *ctx, const void *data, size_t len)
This is a simple hack to mock the hash function during tests to force a high collision hashing functi...
Definition
hashmap.c:77
hmap_hash_t
HMAP_HASH_TYPE hmap_hash_t
Definition
hashmap.h:61
hashmap_tests.h
HMAP_TESTS
#define HMAP_TESTS(X)
Definition
hashmap_tests.h:30
mm_tests.h
MM_TESTS
#define MM_TESTS(X)
Definition
mm_tests.h:30
mutex_tests.h
MUTEX_TESTS
#define MUTEX_TESTS(X)
Definition
mutex_tests.h:28
ns_tests.h
NS_TESTS
#define NS_TESTS(X)
Definition
ns_tests.h:30
pqmh_tests.h
PQMH_TESTS
#define PQMH_TESTS(X)
Definition
pqmh_tests.h:27
reactor_io_tests.h
reactor_tests.h
REACTOR_TESTS
#define REACTOR_TESTS(X)
Definition
reactor_tests.h:38
reader_tests.h
READER_TESTS
#define READER_TESTS(X)
Definition
reader_tests.h:30
seq_tests.h
SEQ_TESTS
#define SEQ_TESTS(X)
Definition
seq_tests.h:28
source_manager_tests.h
len
const size_t len
Definition
source_manager_tests.h:109
SM_TESTS
#define SM_TESTS(X)
Definition
source_manager_tests.h:33
spsc_ring_tests.h
SPSC_RING_TESTS
#define SPSC_RING_TESTS(X)
Definition
spsc_ring_tests.h:30
srn_context_t
Definition
context.h:47
symbol_tests.h
SYMBOL_TESTS
#define SYMBOL_TESTS(X)
Definition
symbol_tests.h:28
value_tests.h
VALUE_TESTS
#define VALUE_TESTS(X)
Definition
value_tests.h:29
tests
runtime
main.c
Serene Runtime is free software, licensed under the
GNU LGPL v3
License.