From 6d3df6922b2cb7777ad32a05ce6108ca7ee9ea65 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 27 Jun 2009 10:04:38 -0400 Subject: [PATCH] Unit Tests - Att - Added unit tests to verify functionality of Att::type, Att::validInternalName and Att::validModifiableName. --- src/tests/att.t.cpp | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/tests/att.t.cpp b/src/tests/att.t.cpp index 8def0e542..f50c0e55d 100644 --- a/src/tests/att.t.cpp +++ b/src/tests/att.t.cpp @@ -33,7 +33,7 @@ Context context; //////////////////////////////////////////////////////////////////////////////// int main (int argc, char** argv) { - UnitTest t (67); + UnitTest t (95); Att a; t.notok (a.valid ("name"), "Att::valid name -> fail"); @@ -247,6 +247,40 @@ int main (int argc, char** argv) try {a7.parse (n);} catch (...) {good = false;} t.notok (good, "Att::parse (name.bogus:\"value\")"); + // Att::type + t.is (a.type ("entry"), "date", "Att::type entry -> date"); + t.is (a.type ("due"), "date", "Att::type due -> date"); + t.is (a.type ("until"), "date", "Att::type until -> date"); + t.is (a.type ("start"), "date", "Att::type start -> date"); + t.is (a.type ("end"), "date", "Att::type end -> date"); + t.is (a.type ("wait"), "date", "Att::type wait -> date"); + t.is (a.type ("recur"), "duration", "Att::type recur -> duration"); + t.is (a.type ("limit"), "number", "Att::type limit -> number"); + t.is (a.type ("description"), "text", "Att::type description -> text"); + t.is (a.type ("foo"), "text", "Att::type foo -> text"); + + // Att::validInternalName + t.ok (Att::validInternalName ("entry"), "internal entry"); + t.ok (Att::validInternalName ("start"), "internal start"); + t.ok (Att::validInternalName ("end"), "internal end"); + t.ok (Att::validInternalName ("parent"), "internal parent"); + t.ok (Att::validInternalName ("uuid"), "internal uuid"); + t.ok (Att::validInternalName ("mask"), "internal mask"); + t.ok (Att::validInternalName ("imask"), "internal imask"); + t.ok (Att::validInternalName ("limit"), "internal limit"); + t.ok (Att::validInternalName ("status"), "internal status"); + t.ok (Att::validInternalName ("description"), "internal description"); + + // Att::validModifiableName + t.ok (Att::validModifiableName ("project"), "modifiable project"); + t.ok (Att::validModifiableName ("priority"), "modifiable priority"); + t.ok (Att::validModifiableName ("fg"), "modifiable fg"); + t.ok (Att::validModifiableName ("bg"), "modifiable bg"); + t.ok (Att::validModifiableName ("due"), "modifiable due"); + t.ok (Att::validModifiableName ("recur"), "modifiable recur"); + t.ok (Att::validModifiableName ("until"), "modifiable until"); + t.ok (Att::validModifiableName ("wait"), "modifiable wait"); + return 0; }