repo.or.cz
/
vala-lang.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
D-Bus: Fix signals with string array parameters in dynamic clients
[vala-lang.git]
/
tests
/
basic-types
/
integers.vala
blob
d9ff8903d8f26141bc6d8ef189fb6653be6b8f29
1
void
test_int
() {
2
// declaration and initialization
3
int
i
=
42
;
4
assert
(
i
==
42
);
5
6
// assignment
7
i
=
23
;
8
assert
(
i
==
23
);
9
10
// access
11
int
j
=
i
;
12
assert
(
j
==
23
);
13
14
// +
15
i
=
42
+
23
;
16
assert
(
i
==
65
);
17
18
// -
19
i
=
42
-
23
;
20
assert
(
i
==
19
);
21
22
// *
23
i
=
42
*
23
;
24
assert
(
i
==
966
);
25
26
// /
27
i
=
42
/
23
;
28
assert
(
i
==
1
);
29
30
// %
31
i
=
42
%
23
;
32
assert
(
i
==
19
);
33
34
// <<
35
i
=
42
<<
3
;
36
assert
(
i
==
336
);
37
38
// >>
39
i
=
42
>>
3
;
40
assert
(
i
==
5
);
41
42
// &
43
i
=
42
&
23
;
44
assert
(
i
==
2
);
45
46
// |
47
i
=
42
|
23
;
48
assert
(
i
==
63
);
49
50
// ^
51
i
=
42
^
23
;
52
assert
(
i
==
61
);
53
54
// equality and relational
55
i
=
42
;
56
assert
(
i
==
42
);
57
assert
(
i
!=
50
);
58
assert
(
i
<
50
);
59
assert
(!(
i
<
40
));
60
assert
(
i
<=
42
);
61
assert
(!(
i
<=
41
));
62
assert
(
i
>=
42
);
63
assert
(!(
i
>=
43
));
64
assert
(
i
>
40
);
65
assert
(!(
i
>
50
));
66
67
// to_string
68
string
s
=
i
.
to_string
();
69
assert
(
s
==
"42"
);
70
71
// ensure that MIN and MAX are valid values
72
i
=
int
.
MIN
;
73
assert
(
i
==
int
.
MIN
);
74
assert
(
i
<
int
.
MAX
);
75
i
=
int
.
MAX
;
76
assert
(
i
==
int
.
MAX
);
77
assert
(
i
>
int
.
MIN
);
78
}
79
80
void
main
() {
81
test_int
();
82
}