]> git.xonotic.org Git - xonotic/gmqcc.git/blob - tests/correct-vs-short.qc
fix -fshort-logic to cast to true boolean values
[xonotic/gmqcc.git] / tests / correct-vs-short.qc
1 void   print(...)   = #1;
2 string ftos (float) = #2;
3
4 void test(vector a, vector b) {
5     print(ftos((a && b) + (a && b)), " ");
6     print(ftos((a || b) + (a || b)), " ");
7     print(ftos((a && b) + (a || b)), "\n");
8 }
9
10 void main() {
11     print("X               & | B\n");
12     print("0 0 0, 0 0 0 :: "); test('0 0 0', '0 0 0');
13     print("0 0 0, 5 0 0 :: "); test('0 0 0', '5 0 0');
14     print("5 0 0, 0 0 0 :: "); test('5 0 0', '0 0 0');
15     print("5 0 0, 5 0 0 :: "); test('5 0 0', '5 0 0');
16     print("Y               & | B\n");
17     print("0 0 0, 0 0 0 :: "); test('0 0 0', '0 0 0');
18     print("0 0 0, 0 5 0 :: "); test('0 0 0', '0 5 0');
19     print("0 5 0, 0 0 0 :: "); test('0 5 0', '0 0 0');
20     print("0 5 0, 0 5 0 :: "); test('0 5 0', '0 5 0');
21 }