mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Test: Conditional compilation allows Taskserver to reuse code
This commit is contained in:
parent
f15e93ccc8
commit
7b8df7a439
2 changed files with 12 additions and 0 deletions
|
@ -71,7 +71,11 @@ void testParse (
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
int main (int, char**)
|
int main (int, char**)
|
||||||
{
|
{
|
||||||
|
#ifdef PRODUCT_TASKWARRIOR
|
||||||
UnitTest t (1025);
|
UnitTest t (1025);
|
||||||
|
#else
|
||||||
|
UnitTest t (996);
|
||||||
|
#endif
|
||||||
|
|
||||||
ISO8601d iso;
|
ISO8601d iso;
|
||||||
std::string::size_type start = 0;
|
std::string::size_type start = 0;
|
||||||
|
@ -469,6 +473,7 @@ int main (int, char**)
|
||||||
t.is (ISO8601d ("5/1/2011", "m/d/Y").dayOfYear (), 121, "dayOfYear (5/1/2011) -> 121");
|
t.is (ISO8601d ("5/1/2011", "m/d/Y").dayOfYear (), 121, "dayOfYear (5/1/2011) -> 121");
|
||||||
t.is (ISO8601d ("12/31/2011", "m/d/Y").dayOfYear (), 365, "dayOfYear (12/31/2011) -> 365");
|
t.is (ISO8601d ("12/31/2011", "m/d/Y").dayOfYear (), 365, "dayOfYear (12/31/2011) -> 365");
|
||||||
|
|
||||||
|
#ifdef PRODUCT_TASKWARRIOR
|
||||||
// Relative dates.
|
// Relative dates.
|
||||||
ISO8601d r1 ("today");
|
ISO8601d r1 ("today");
|
||||||
t.ok (r1.sameDay (now), "today = now");
|
t.ok (r1.sameDay (now), "today = now");
|
||||||
|
@ -567,6 +572,7 @@ int main (int, char**)
|
||||||
(now.month () >= 10 &&
|
(now.month () >= 10 &&
|
||||||
soq.year () == now.year () + 1), "soq is in same year as now");
|
soq.year () == now.year () + 1), "soq is in same year as now");
|
||||||
t.ok (eoq.sameYear (now), "eoq is in same year as now");
|
t.ok (eoq.sameYear (now), "eoq is in same year as now");
|
||||||
|
#endif
|
||||||
|
|
||||||
// ISO8601d::sameHour
|
// ISO8601d::sameHour
|
||||||
ISO8601d r20 ("6/7/2010 01:00:00", "m/d/Y H:N:S");
|
ISO8601d r20 ("6/7/2010 01:00:00", "m/d/Y H:N:S");
|
||||||
|
|
|
@ -37,7 +37,11 @@ Context context;
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
int main (int, char**)
|
int main (int, char**)
|
||||||
{
|
{
|
||||||
|
#ifdef PRODUCT_TASKWARRIOR
|
||||||
UnitTest t (1274);
|
UnitTest t (1274);
|
||||||
|
#else
|
||||||
|
UnitTest t (1256);
|
||||||
|
#endif
|
||||||
|
|
||||||
std::vector <std::pair <std::string, Lexer::Type>> tokens;
|
std::vector <std::pair <std::string, Lexer::Type>> tokens;
|
||||||
std::string token;
|
std::string token;
|
||||||
|
@ -457,9 +461,11 @@ int main (int, char**)
|
||||||
{ "2015-02-17", { { "2015-02-17", Lexer::Type::date }, NO, NO, NO, NO }, },
|
{ "2015-02-17", { { "2015-02-17", Lexer::Type::date }, NO, NO, NO, NO }, },
|
||||||
{ "2013-11-29T22:58:00Z", { { "2013-11-29T22:58:00Z", Lexer::Type::date }, NO, NO, NO, NO }, },
|
{ "2013-11-29T22:58:00Z", { { "2013-11-29T22:58:00Z", Lexer::Type::date }, NO, NO, NO, NO }, },
|
||||||
{ "20131129T225800Z", { { "20131129T225800Z", Lexer::Type::date }, NO, NO, NO, NO }, },
|
{ "20131129T225800Z", { { "20131129T225800Z", Lexer::Type::date }, NO, NO, NO, NO }, },
|
||||||
|
#ifdef PRODUCT_TASKWARRIOR
|
||||||
{ "9th", { { "9th", Lexer::Type::date }, NO, NO, NO, NO }, },
|
{ "9th", { { "9th", Lexer::Type::date }, NO, NO, NO, NO }, },
|
||||||
{ "10th", { { "10th", Lexer::Type::date }, NO, NO, NO, NO }, },
|
{ "10th", { { "10th", Lexer::Type::date }, NO, NO, NO, NO }, },
|
||||||
{ "today", { { "today", Lexer::Type::date }, NO, NO, NO, NO }, },
|
{ "today", { { "today", Lexer::Type::date }, NO, NO, NO, NO }, },
|
||||||
|
#endif
|
||||||
|
|
||||||
// Duration
|
// Duration
|
||||||
{ "year", { { "year", Lexer::Type::duration }, NO, NO, NO, NO }, },
|
{ "year", { { "year", Lexer::Type::duration }, NO, NO, NO, NO }, },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue