summaryrefslogtreecommitdiff
path: root/tests/cris/check_int64.c
blob: fc600176e2329711988e056dd6af39e57aff40e3 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "sys.h"
#include "crisutils.h"


static inline int64_t add64(const int64_t a, const int64_t b)
{
	return a + b;
}

static inline int64_t sub64(const int64_t a, const int64_t b)
{
	return a - b;
}

int main(void)
{
	int64_t a = 1;
	int64_t b = 2;

	/* FIXME: add some tests.  */
	a = add64(a, b);
	if (a != 3)
		err();

	a = sub64(a, b);
	if (a != 1)
		err();

	a = add64(a, -4);
	if (a != -3)
		err();

	a = add64(a, 3);
	if (a != 0)
		err();

	a = 0;
	a = sub64(a, 1);
	if (a != -1)
		err();

	pass();
	return 0;
}