[gnote] Convert note test to unit test



commit d75fc176a1adf72cd7782e51bc579aa6311578cb
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sat Jan 28 16:45:38 2017 +0200

    Convert note test to unit test

 src/Makefile.am                                |   10 ++-----
 src/test/{notetest.cpp => unit/noteutests.cpp} |   31 ++++++++++-------------
 2 files changed, 17 insertions(+), 24 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 36a4f46..e87bf3a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,10 +23,8 @@ GNOTE_LIBS = libgnote.la $(LIBGNOTE_LIBS)
 
 lib_LTLIBRARIES = libgnote.la
 bin_PROGRAMS = gnote
-check_PROGRAMS = notetest \
-       notemanagertest gnotesyncclienttest
-TESTS = notetest \
-       notemanagertest gnotesyncclienttest
+check_PROGRAMS = notemanagertest gnotesyncclienttest
+TESTS = notemanagertest gnotesyncclienttest
 
 if HAVE_UNITTESTCPP
 check_PROGRAMS += gnoteunittests
@@ -37,6 +35,7 @@ gnoteunittests_SOURCES = \
        test/unit/datetimeutests.cpp \
        test/unit/filesutests.cpp \
        test/unit/fileinfoutests.cpp \
+       test/unit/noteutests.cpp \
        test/unit/stringutests.cpp \
        test/unit/trieutests.cpp \
        test/unit/uriutests.cpp \
@@ -46,9 +45,6 @@ gnoteunittests_LDADD = libgnote.la @UNITTESTCPP_LIBS@
 endif
 
 
-notetest_SOURCES = test/notetest.cpp
-notetest_LDADD =  $(GNOTE_LIBS) -lX11
-
 notemanagertest_SOURCES = test/notemanagertest.cpp \
        test/testnote.cpp test/testnote.hpp \
        test/testnotemanager.cpp test/testnotemanager.hpp \
diff --git a/src/test/notetest.cpp b/src/test/unit/noteutests.cpp
similarity index 52%
rename from src/test/notetest.cpp
rename to src/test/unit/noteutests.cpp
index c09e069..b61d0c1 100644
--- a/src/test/notetest.cpp
+++ b/src/test/unit/noteutests.cpp
@@ -1,8 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2014 Aurimas Cernius
- * Copyright (C) 2009 Hubert Figuiere
+ * Copyright (C) 2017 Aurimas Cernius
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -20,31 +19,29 @@
 
 
 
-#include <string>
 #include <list>
 
-#include <boost/test/minimal.hpp>
-
 #include <libxml/tree.h>
+#include <UnitTest++/UnitTest++.h>
 
 #include "note.hpp"
 
-int test_main(int /*argc*/, char ** /*argv*/)
+SUITE(Note)
 {
-//  std::string markup = "<tags><tag>system:notebook:ggoiiii</tag><tag>system:template</tag></tags>";
-  std::string markup = "<tags 
xmlns=\"http://beatniksoftware.com/tomboy\";><tag>system:notebook:ggoiiii</tag><tag>system:template</tag></tags>";
+  TEST(tags)
+  {
+    Glib::ustring markup = "<tags 
xmlns=\"http://beatniksoftware.com/tomboy\";><tag>system:notebook:ggoiiii</tag><tag>system:template</tag></tags>";
 
-  xmlDocPtr doc = xmlParseDoc((const xmlChar*)markup.c_str());
-  BOOST_CHECK(doc);
+    xmlDocPtr doc = xmlParseDoc((const xmlChar*)markup.c_str());
+    CHECK(doc);
 
-  if(doc) {
-    std::list<Glib::ustring> tags;
-    gnote::NoteBase::parse_tags(xmlDocGetRootElement(doc), tags);
-    BOOST_CHECK(!tags.empty());
+    if(doc) {
+      std::list<Glib::ustring> tags;
+      gnote::NoteBase::parse_tags(xmlDocGetRootElement(doc), tags);
+      CHECK(!tags.empty());
 
-    xmlFreeDoc(doc);
+      xmlFreeDoc(doc);
+    }
   }
-
-  return 0;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]