scc

A fork of https://git.simple-cc.org/scc/ for Qute

git clone https://git.8pit.net/scc.git

 1#include <assert.h>
 2#include <limits.h>
 3#include <stdio.h>
 4#include <stdlib.h>
 5
 6/*
 7output:
 8testing
 9done
10end:
11*/
12
13void
14test(void)
15{
16	long long n;
17	char buf[64];
18
19	n = atoll("abc");
20	assert(n == 0);
21
22	n = atoll(" abc");
23	assert(n == 0);
24
25	n = atoll("1234 ");
26	assert(n == 1234);
27
28	n = atoll(" 1234 0");
29	assert(n == 1234);
30
31	n = atoll("+");
32	assert(n == 0);
33
34	n = atoll(" +1");
35	assert(n == 1);
36
37	n = atoll("+ 1");
38	assert(n == 0);
39
40	n = atoll(" -1");
41	assert(n == -1);
42
43	n = atoll("- 1");
44	assert(n == 0);
45
46	sprintf(buf, "%lld", LONG_MAX);
47	n = atoll(buf);
48	assert(n == LLONG_MAX);
49
50	sprintf(buf, "%lld", LONG_MIN);
51	n = atoll(buf);
52	assert(n == LLONG_MIN);
53}
54
55int
56main()
57{
58	puts("testing");
59	test();
60	puts("done");
61
62	return 0;
63}