Test overloaded bool:
-tagged operators
This commit is contained in:
parent
25b3fd0102
commit
101205ed10
5
source/compiler/tests/warning_247_ovl.meta
Normal file
5
source/compiler/tests/warning_247_ovl.meta
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
'test_type': 'output_check',
|
||||
'errors': """
|
||||
"""
|
||||
}
|
36
source/compiler/tests/warning_247_ovl.pwn
Normal file
36
source/compiler/tests/warning_247_ovl.pwn
Normal file
@ -0,0 +1,36 @@
|
||||
// This test makes sure overloaded operators for tag `bool:` don't trigger
|
||||
// warning 247. The code in 'main()' is copied from file "warning_247.pwn",
|
||||
// but with the lines that test operators `<<`, `>>`, `>>>` and `~` removed,
|
||||
// as shift operators can't be overloaded and `~` is reserved for destructors.
|
||||
|
||||
bool:operator -(bool:oper) return oper;
|
||||
bool:operator ++(bool:oper) return oper;
|
||||
bool:operator --(bool:oper) return oper;
|
||||
bool:operator *(bool:oper1, bool:oper2) return oper1,oper2;
|
||||
bool:operator /(bool:oper1, bool:oper2) return oper1,oper2;
|
||||
bool:operator %(bool:oper1, bool:oper2) return oper1,oper2;
|
||||
bool:operator +(bool:oper1, bool:oper2) return oper1,oper2;
|
||||
bool:operator -(bool:oper1, bool:oper2) return oper1,oper2;
|
||||
bool:operator <=(bool:oper1, bool:oper2) return oper1,oper2;
|
||||
bool:operator >=(bool:oper1, bool:oper2) return oper1,oper2;
|
||||
bool:operator <(bool:oper1, bool:oper2) return oper1,oper2;
|
||||
bool:operator >(bool:oper1, bool:oper2) return oper1,oper2;
|
||||
|
||||
main()
|
||||
{
|
||||
new bool:a = true, bool:b = false;
|
||||
if (a <= b) {}
|
||||
if (a >= b) {}
|
||||
if (a < b) {}
|
||||
if (a > b) {}
|
||||
if (-a) {}
|
||||
if (++a) {}
|
||||
if (a++) {}
|
||||
if (--a) {}
|
||||
if (a--) {}
|
||||
if (a * b) {}
|
||||
if (a / b) {}
|
||||
if (a % b) {}
|
||||
if (a + b) {}
|
||||
if (a - b) {}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user