summaryrefslogtreecommitdiff
path: root/libcr/tests/test_matrix.c
blob: eaa4bdca0f91f7b8fd45db033bb0d642fbdcb2ec (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-2025  Luke T. Shumaker <lukeshu@lukeshu.com>
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

#include <libcr/coroutine.h>

int a = 1;

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

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