Skip to content

Commit 101205e

Browse files
committed
Test overloaded bool:-tagged operators
1 parent 25b3fd0 commit 101205e

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
'test_type': 'output_check',
3+
'errors': """
4+
"""
5+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// This test makes sure overloaded operators for tag `bool:` don't trigger
2+
// warning 247. The code in 'main()' is copied from file "warning_247.pwn",
3+
// but with the lines that test operators `<<`, `>>`, `>>>` and `~` removed,
4+
// as shift operators can't be overloaded and `~` is reserved for destructors.
5+
6+
bool:operator -(bool:oper) return oper;
7+
bool:operator ++(bool:oper) return oper;
8+
bool:operator --(bool:oper) return oper;
9+
bool:operator *(bool:oper1, bool:oper2) return oper1,oper2;
10+
bool:operator /(bool:oper1, bool:oper2) return oper1,oper2;
11+
bool:operator %(bool:oper1, bool:oper2) return oper1,oper2;
12+
bool:operator +(bool:oper1, bool:oper2) return oper1,oper2;
13+
bool:operator -(bool:oper1, bool:oper2) return oper1,oper2;
14+
bool:operator <=(bool:oper1, bool:oper2) return oper1,oper2;
15+
bool:operator >=(bool:oper1, bool:oper2) return oper1,oper2;
16+
bool:operator <(bool:oper1, bool:oper2) return oper1,oper2;
17+
bool:operator >(bool:oper1, bool:oper2) return oper1,oper2;
18+
19+
main()
20+
{
21+
new bool:a = true, bool:b = false;
22+
if (a <= b) {}
23+
if (a >= b) {}
24+
if (a < b) {}
25+
if (a > b) {}
26+
if (-a) {}
27+
if (++a) {}
28+
if (a++) {}
29+
if (--a) {}
30+
if (a--) {}
31+
if (a * b) {}
32+
if (a / b) {}
33+
if (a % b) {}
34+
if (a + b) {}
35+
if (a - b) {}
36+
}

0 commit comments

Comments
 (0)