summaryrefslogtreecommitdiff
path: root/libcr/tests/test_matrix.c
blob: 1f2345568d32514cc6b0642aba2f6fb8f34c7b26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* libcr/tests/test_matrix.c - Tests for libcr
 *
 * Copyright (C) 2024  Luke T. Shumaker <lukeshu@lukeshu.com>
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

#include <libcr/coroutine.h>

int a = 1;

COROUTINE cr_init(void *) {
	cr_begin();
	a = 2;
	cr_end();
}

int main() {
	coroutine_add("init", cr_init, NULL);
	coroutine_main();
	if (a != 2)
		return 1;
	coroutine_main();
	return 0;
}