mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Unit Tests
- Added _neg_ unit tests for integer, real and duration.
This commit is contained in:
parent
0f780bcfae
commit
fe2f5de230
1 changed files with 14 additions and 1 deletions
|
@ -46,7 +46,7 @@ bool get (const std::string& name, Variant& value)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
UnitTest t (46);
|
||||
UnitTest t (52);
|
||||
|
||||
// Test the source independently.
|
||||
Variant v;
|
||||
|
@ -150,6 +150,19 @@ int main (int argc, char** argv)
|
|||
t.is (result.type (), Variant::type_boolean, "infix '!true' --> boolean");
|
||||
t.is (result.get_bool (), false, "infix '!true' --> false");
|
||||
|
||||
// _neg_
|
||||
e.evaluateInfixExpression ("- 1", result);
|
||||
t.is (result.type (), Variant::type_integer, "infix '- 1' --> integer");
|
||||
t.is (result.get_integer (), -1, "infix '- 1' --> -1");
|
||||
|
||||
e.evaluateInfixExpression ("- 1.2", result);
|
||||
t.is (result.type (), Variant::type_real, "infix '- 1.2' --> real");
|
||||
t.is (result.get_real (), -1.2, "infix '- 1.2' --> -1.2");
|
||||
|
||||
e.evaluateInfixExpression ("- 2days", result);
|
||||
t.is (result.type (), Variant::type_duration, "infix '- 2days' --> duration");
|
||||
t.is (result.get_duration (), -86400*2, "infix '- 2days' --> -86400 * 2");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue