-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnicetest.c
43 lines (38 loc) · 836 Bytes
/
nicetest.c
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
#include "types.h"
#include "user.h"
int
main(int argc, char *argv[])
{
printf(1, "nice test\n");
int oval = nice(0);
printf(1,"oval value is %d", oval);
int nval;
if (oval < 0) {
nval = nice(10);
if (nval == oval + 10) {
printf(1, "successfully called nice(10)\n");
} else {
printf(1, "nice(10) failed\n");
}
} else {
nval = nice(-10);
if (nval == oval - 10) {
printf(1, "successfully called nice(-10)\n");
} else {
printf(1, "nice(-10) failed\n");
}
}
nval = nice(100);
if (nval == 19) {
printf(1, "successfully called nice(100)\n");
} else {
printf(1, "nice(100) failed\n");
}
nval = nice(-100);
if (nval == -20) {
printf(1, "successfully called nice(-100)\n");
} else {
printf(1, "nice(-100) failed\n");
}
exit();
}