Test overloaded bool:-tagged operators

This commit is contained in:
Stanislav Gromov 2020-12-11 19:02:53 +07:00
parent 25b3fd0102
commit 101205ed10
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,5 @@
{
'test_type': 'output_check',
'errors': """
"""
}

View 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) {}
}