Switch guththila tests to use gtest
diff --git a/guththila/Makefile.am b/guththila/Makefile.am
index f93117b..ba2e311 100644
--- a/guththila/Makefile.am
+++ b/guththila/Makefile.am
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 datadir=$(prefix)
-SUBDIRS = src 
+SUBDIRS = src $(GTEST) $(TESTDIR)
 includedir=$(prefix)/include/axis2-${PACKAGE_VERSION}/
 include_HEADERS=$(top_builddir)/include/*.h
 data_DATA= INSTALL README AUTHORS NEWS LICENSE COPYING
diff --git a/guththila/configure.ac b/guththila/configure.ac
index eb0c3bf..da1b141 100644
--- a/guththila/configure.ac
+++ b/guththila/configure.ac
@@ -28,6 +28,7 @@
 dnl Checks for programs.
 AC_PROG_CC
 AC_PROG_CPP
+AC_PROG_CXX
 AC_PROG_LIBTOOL
 AC_PROG_INSTALL
 AC_PROG_LN_S
@@ -79,6 +80,7 @@
     AC_MSG_RESULT(yes)
     CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
     CPPFLAGS="$CPPFLAGS -fprofile-arcs -ftest-coverage"
+    LDFLAGS="$LDFLAGS -lgcov --coverage"
     ;;
   esac ],[
   AC_MSG_RESULT(no)
@@ -86,6 +88,44 @@
   CPPFLAGS="$CPPFLAGS"]
 )
 
+AC_MSG_CHECKING(whether to use the Google test framework)
+AC_ARG_WITH(gtest,
+            [  --with-gtest[=PATH]      Find the gtest source files in 'PATH'.],
+[ case "$withval" in
+  no)
+    AC_MSG_RESULT(no)
+    USE_GTEST=""
+    GTEST_DIR=""
+    GTEST=""
+    ;;
+  *)
+    AC_MSG_RESULT(yes)
+    GTEST_DIR="$withval"
+    GTEST="gtest"
+    CXXFLAGS="$CXXFLAGS -g -Wall -Wextra -pthread"
+    ;;
+  esac ],
+  AC_MSG_RESULT(no)
+)
+
+AC_MSG_CHECKING(whether to build tests)
+AC_ARG_ENABLE(tests, [  --enable-tests    build tests. default=no],
+[ case "${enableval}" in
+  yes)
+    AC_MSG_RESULT(yes)
+    TESTDIR="tests"
+    ;;
+  *)
+    AC_MSG_RESULT(no)
+    TESTDIR=""
+
+    ;;
+  esac ],
+  AC_MSG_RESULT(no)
+  TESTDIR=""
+)
+
+
 
 
 dnl Checks for header files.
@@ -106,9 +146,14 @@
 
 AC_SUBST(UTILINC)
 AC_SUBST(VERSION_NO)
+AC_SUBST(GTEST_DIR)
+AC_SUBST(GTEST)
+AC_SUBST(TESTDIR)
 
 AC_CONFIG_FILES([Makefile \
     src/Makefile \
+    gtest/Makefile \
+    tests/Makefile \
     ])
-    
+
 AC_OUTPUT
diff --git a/guththila/gtest/Makefile.am b/guththila/gtest/Makefile.am
new file mode 100644
index 0000000..34b967b
--- /dev/null
+++ b/guththila/gtest/Makefile.am
@@ -0,0 +1,14 @@
+
+noinst_LIBRARIES = libgtest.a libgtest_main.a
+
+libgtest_a_SOURCES = $(GTEST_DIR)/src/gtest-all.cc
+libgtest_a_CPPFLAGS = -I$(GTEST_DIR)/include -I$(GTEST_DIR)
+libgtest_a_CXXFLAGS = -g -Wall -Wextra
+libgtest_a_LDFLAGS = -pthread
+
+libgtest_main_a_SOURCES = $(GTEST_DIR)/src/gtest_main.cc
+libgtest_main_CPPFLAGS = -I$(GTEST_DIR)/include -I$(GTEST_DIR)
+libgtest_main_a_CXXFLAGS = -g -Wall -Wextra
+libgtest_main_LDFLAGS = -pthread
+libgtest_main_a_LIBADD = libgtest.a
+
diff --git a/guththila/tests/s b/guththila/tests/s
deleted file mode 100755
index 7e9f4f8..0000000
--- a/guththila/tests/s
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/perl -w
-use strict;
-
-if ($ARGV[0] == 1)
-{
-    print "compiling writer\n";
-    system "gcc -Wall -g3 -O0  -o writer guththila_writer_main.c -L\$AXIS2C_HOME/lib -I\$AXIS2C_HOME/include -lguththila -laxis2_util";
-}
-else
-{
-    print "compiling reader tests \n";
-    system "gcc -Wall -g3 -O0  -o reader *.c \-L\$AXIS2C_HOME/lib \-I\$AXIS2C_HOME/include -lcheck -lguththila \-laxis2_util";
-}
diff --git a/guththila/tests/test.c b/guththila/tests/test.c
deleted file mode 100644
index 4442c50..0000000
--- a/guththila/tests/test.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*      http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#include <check.h>
-#include <guththila.h>
-#include "guththila_defines.h"
-#include "test.h"
-
-void
-setup(
-    void)
-{
-    allocator = axutil_allocator_init(NULL);
-    env = axutil_env_create(allocator);
-}
-
-void
-teardown(
-    void)
-{
-    guththila_reader_free(env, red);
-    guththila_free(env, parser);
-    axutil_env_free(env);
-}
-
-START_TEST(test_guththila)
-{
-    red = guththila_reader_create_for_file(env, "resources/om/axis.xml");
-    parser = guththila_create(env, red);
-    fail_if(red == NULL, "guththila reader failed");
-    fail_if(parser == NULL, "guththila parser failed");
-}
-
-END_TEST
-START_TEST(
-    test_guththila_start_element)
-{
-    int c = 0;
-    char *p;
-    red = guththila_reader_create_for_file(env, "resources/om/axis.xml");
-    parser = guththila_create(env, red);
-    guththila_read(env, parser);
-    c = guththila_next(env, parser);
-
-    while((c != GUTHTHILA_START_ELEMENT))
-        c = guththila_next(env, parser);
-    p = guththila_get_name(env, parser);
-    fail_unless((c == GUTHTHILA_START_ELEMENT), "no start element found");
-    fail_if((p == NULL), "no name found");
-    fail_unless(!strcmp(p, "root"), "root element differed");
-    c = 0;
-
-    while((c != GUTHTHILA_START_ELEMENT))
-        c = guththila_next(env, parser);
-    p = guththila_get_name(env, parser);
-    fail_unless((c == GUTHTHILA_START_ELEMENT), "no start element found");
-    fail_if((p == NULL), "no name found");
-    fail_unless(!strcmp(p, "a"), "a element differed");
-
-    c = 0;
-    while((c != GUTHTHILA_START_ELEMENT))
-        c = guththila_next(env, parser);
-    p = guththila_get_name(env, parser);
-    fail_unless(!strcmp(p, "b"), "b element differed");
-}
-
-END_TEST
-START_TEST(
-    test_guththila_empty_element)
-{
-    int c = 0;
-    char *p;
-    red = guththila_reader_create_for_file(env, "resources/om/axis.xml");
-    parser = guththila_create(env, red);
-    guththila_read(env, parser);
-    c = guththila_next(env, parser);
-
-    while((c != GUTHTHILA_EMPTY_ELEMENT))
-        c = guththila_next(env, parser);
-    p = guththila_get_name(env, parser);
-    fail_unless((c == GUTHTHILA_EMPTY_ELEMENT), "no empty element found");
-    fail_if((p == NULL), "no name found");
-    fail_unless(!strcmp(p, "a.1"), "a.1 element differed");
-
-    c = 0;
-
-    while((c != GUTHTHILA_EMPTY_ELEMENT))
-        c = guththila_next(env, parser);
-    p = guththila_get_name(env, parser);
-    fail_unless((c == GUTHTHILA_EMPTY_ELEMENT), "no empty element found");
-    fail_if((p == NULL), "no name found");
-    fail_unless(!strcmp(p, "a.2"), "a.2 element differed");
-
-    c = 0;
-    while((c != GUTHTHILA_START_ELEMENT))
-        c = guththila_next(env, parser);
-
-    c = 0;
-    while((c != GUTHTHILA_EMPTY_ELEMENT))
-        c = guththila_next(env, parser);
-    p = guththila_get_name(env, parser);
-    fail_unless((c == GUTHTHILA_EMPTY_ELEMENT), "no empty element found");
-    fail_if((p == NULL), "no name found");
-    fail_unless(!strcmp(p, "b.1"), "b.1 element differed");
-}
-
-END_TEST
-START_TEST(
-    test_guththila_end_element)
-{
-    int c = 0;
-    char *p;
-    red = guththila_reader_create_for_file(env, "resources/om/axis.xml");
-    parser = guththila_create(env, red);
-    guththila_read(env, parser);
-    c = guththila_next(env, parser);
-
-    while((c != GUTHTHILA_END_ELEMENT))
-        c = guththila_next(env, parser);
-    p = guththila_get_name(env, parser);
-    fail_unless((c == GUTHTHILA_END_ELEMENT), "no end element found");
-    fail_if((p == NULL), "no name found");
-    fail_unless(!strcmp(p, "a"), "a element differed");
-
-    c = 0;
-    while((c != GUTHTHILA_END_ELEMENT))
-        c = guththila_next(env, parser);
-    p = guththila_get_name(env, parser);
-    fail_unless((c == GUTHTHILA_END_ELEMENT), "no endelement found");
-    fail_if((p == NULL), "no name found");
-    fail_unless(!strcmp(p, "b"), "b element differed");
-
-    c = 0;
-    while((c != GUTHTHILA_END_ELEMENT))
-        c = guththila_next(env, parser);
-    p = guththila_get_name(env, parser);
-    fail_unless((c == GUTHTHILA_END_ELEMENT), "no empty element found");
-    fail_if((p == NULL), "no name found");
-    fail_unless(!strcmp(p, "root"), "root element differed");
-}
-
-END_TEST
-START_TEST(
-    test_guththila_character)
-{
-    int c = 0;
-    int i = 0;
-    char *p;
-    red = guththila_reader_create_for_file(env, "resources/om/numbers.xml");
-    parser = guththila_create(env, red);
-    guththila_read(env, parser);
-    c = guththila_next(env, parser);
-    while(i < 3)
-    {
-        if(c == GUTHTHILA_START_ELEMENT)
-            i++;
-        c = guththila_next(env, parser);
-    }
-
-    if(c == GUTHTHILA_CHARACTER)
-        p = guththila_get_value(env, parser);
-    fail_unless(!strcmp(p, "3"), "3 not found");
-
-    c = 0;
-    while((c != GUTHTHILA_CHARACTER) || (parser->is_whitespace))
-        c = guththila_next(env, parser);
-    p = guththila_get_value(env, parser);
-    fail_unless(!strcmp(p, "24"), "24 not found");
-
-}
-END_TEST Suite *
-guththila_suite(
-    void)
-{
-    Suite *s = suite_create("Guththila");
-
-    /* Core test case */
-    TCase *tc_core = tcase_create("Core");
-    tcase_add_checked_fixture(tc_core, setup, teardown);
-    tcase_add_test(tc_core, test_guththila);
-    tcase_add_test(tc_core, test_guththila_start_element);
-    tcase_add_test(tc_core, test_guththila_empty_element);
-    tcase_add_test(tc_core, test_guththila_end_element);
-    tcase_add_test(tc_core, test_guththila_character);
-    suite_add_tcase(s, tc_core);
-    return s;
-}
-
-int
-main(
-    void)
-{
-    int number_failed;
-    Suite *s = guththila_suite();
-    Suite *att = guththila_attribute_suite();
-    SRunner *sr = srunner_create(s);
-    srunner_add_suite(sr, att);
-    srunner_set_log(sr, "guththila.log");
-    srunner_run_all(sr, CK_NORMAL);
-    number_failed = srunner_ntests_failed(sr);
-    srunner_free(sr);
-    return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
diff --git a/guththila/tests/test.h b/guththila/tests/test.h
deleted file mode 100644
index de27369..0000000
--- a/guththila/tests/test.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*      http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifndef _GUTHTHILA_TESTS_
-#define _GUTHTHILA_TESTS_
-#include <check.h>
-#include <guththila.h>
-#include "guththila_defines.h"
-
-axutil_allocator_t *allocator;
-guththila_reader_t *red;
-axutil_env_t *env;
-guththila_t *parser;
-
-void setup(
-    void);
-void teardown(
-    void);
-
-Suite *guththila_suite(
-    void);
-
-Suite *guththila_attribute_suite(
-    void);
-
-#endif
diff --git a/guththila/tests/test_attribute.c b/guththila/tests/test_attribute.c
deleted file mode 100644
index 59afb74..0000000
--- a/guththila/tests/test_attribute.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*      http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#include <guththila.h>
-#include <check.h>
-#include "test.h"
-
-START_TEST(test_attribute)
-{
-    int count = 0;;
-    int c = 0;
-    guththila_attribute_t *att;
-    red = guththila_reader_create_for_file(env, "resources/om/evaluate.xml");
-    parser = guththila_create(env, red);
-    guththila_read(env, parser);
-    c = guththila_next(env, parser);
-    while (!count)
-    {
-        c = guththila_next(env, parser);
-        count = guththila_get_attribute_count(env, parser);
-        if (count)
-        att = guththila_get_attribute(env, parser);
-    }
-    fail_if(count == 0, "guththila attribute count failed");
-    fail_unless(!strcmp
-        (guththila_get_attribute_name(env, parser, att), "color"),
-        "guththila attribute name failed");
-    fail_unless(!strcmp
-        (guththila_get_attribute_value(env, parser, att), "brown"),
-        "guththila attribute value failed");
-}
-
-END_TEST
-START_TEST(
-    test_attribute_prefix)
-{
-    int count = 0;
-    ;
-    int c = 0;
-    guththila_attribute_t *att;
-    red = guththila_reader_create_for_file(env, "resources/soap/soapmessage.xml");
-    parser = guththila_create(env, red);
-    guththila_read(env, parser);
-    c = guththila_next(env, parser);
-    while(!count)
-    {
-        c = guththila_next(env, parser);
-        count = guththila_get_attribute_count(env, parser);
-        if(count)
-            att = guththila_get_attribute(env, parser);
-    }
-    fail_if(count == 0, "guththila attribute count failed");
-    fail_unless(!strcmp(guththila_get_attribute_prefix(env, parser, att), "soapenv"),
-        "guththila attribute count failed");
-    fail_unless(!strcmp(guththila_get_attribute_name(env, parser, att), "mustUnderstand"),
-        "guththila attribute count failed");
-    fail_unless(!strcmp(guththila_get_attribute_value(env, parser, att), "0"),
-        "guththila attribute count failed");
-    count = 0;
-    while(!count)
-    {
-        c = guththila_next(env, parser);
-        count = guththila_get_attribute_count(env, parser);
-        if(count)
-            att = guththila_get_attribute(env, parser);
-    }
-    fail_unless(!strcmp(guththila_get_attribute_prefix(env, parser, att), "soapenv"),
-        "guththila attribute count failed");
-    fail_unless(!strcmp(guththila_get_attribute_name(env, parser, att), "mustUnderstand"),
-        "guththila attribute count failed");
-    fail_if(!strcmp(guththila_get_attribute_value(env, parser, att), "1"),
-        "guththila attribute count failed");
-}
-END_TEST Suite *
-guththila_attribute_suite(
-    void)
-{
-    Suite *s = suite_create("Guththila_attribute");
-
-    /* Core test case */
-    TCase *tc_core = tcase_create("attribute");
-    tcase_add_checked_fixture(tc_core, setup, teardown);
-    tcase_add_test(tc_core, test_attribute);
-    tcase_add_test(tc_core, test_attribute_prefix);
-    suite_add_tcase(s, tc_core);
-    return s;
-}
diff --git a/guththila/tests/test_attribute.cc b/guththila/tests/test_attribute.cc
new file mode 100644
index 0000000..1670298
--- /dev/null
+++ b/guththila/tests/test_attribute.cc
@@ -0,0 +1,132 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <gtest/gtest.h>
+
+#include <guththila.h>
+
+
+#define BUF_SIZE 256
+
+class TestAttribute: public ::testing::Test
+{
+
+    protected:
+        void SetUp()
+        {
+            m_allocator = axutil_allocator_init(NULL);
+            ASSERT_NE(m_allocator, nullptr);
+            m_env = axutil_env_create(m_allocator);
+            ASSERT_NE(m_env, nullptr);
+
+            m_parser = (guththila_t*) calloc(1, sizeof(guththila_t));
+            ASSERT_NE(m_parser, nullptr);
+
+            memset(m_buffer, 0, BUF_SIZE);
+
+        }
+
+        void TearDown()
+        {
+
+            guththila_reader_free(m_reader, m_env);
+            m_reader = nullptr;
+            guththila_un_init(m_parser, m_env);
+            m_parser = nullptr;
+            axutil_env_free(m_env);
+
+        }
+
+        guththila_reader_t *m_reader;
+        axutil_allocator_t *m_allocator;
+        axutil_env_t *m_env;
+        guththila_t *m_parser;
+        char m_buffer[BUF_SIZE];
+
+};
+
+TEST_F(TestAttribute, test_attribute) {
+
+    int count = 0;
+    int c = 0;
+    guththila_attr_t *att;
+
+    m_reader = guththila_reader_create_for_file("resources/om/evaluate.xml", m_env);
+    ASSERT_NE(m_reader, nullptr);
+    guththila_init(m_parser, m_reader, m_env);
+
+    guththila_reader_read(m_parser->reader, m_buffer, 0, BUF_SIZE,  m_env);
+    c = guththila_next(m_parser, m_env);
+
+    while (!count)
+    {
+        /* FIXME:  This is potentially an infinite loop */
+        c = guththila_next(m_parser, m_env);
+        count = guththila_get_attribute_count(m_parser, m_env);
+        if (count)
+            att = guththila_get_attribute(m_parser, m_env);
+    }
+
+    ASSERT_NE(count, 0);
+    ASSERT_STREQ(guththila_get_attribute_name(m_parser, att, m_env), "color");
+    ASSERT_STREQ(guththila_get_attribute_value(m_parser, att, m_env), "brown");
+
+}
+
+
+TEST_F(TestAttribute, test_attribute_prefix) {
+
+    int count = 0;
+    int c = 0;
+    guththila_attr_t *att;
+
+    m_reader = guththila_reader_create_for_file("resources/soap/soapmessage.xml", m_env);
+    ASSERT_NE(m_reader, nullptr);
+    guththila_init(m_parser, m_reader, m_env);
+
+    guththila_reader_read(m_parser->reader, m_buffer, 0, BUF_SIZE,  m_env);
+    c = guththila_next(m_parser, m_env);
+
+    while(!count)
+    {
+        /* FIXME:  This is potentially an infinite loop */
+        c = guththila_next(m_parser, m_env);
+        count = guththila_get_attribute_count(m_parser, m_env);
+        if (count)
+            att = guththila_get_attribute(m_parser, m_env);
+    }
+
+    ASSERT_NE(count, 0);
+    ASSERT_STREQ(guththila_get_attribute_prefix(m_parser, att, m_env), "soapenv");
+    ASSERT_STREQ(guththila_get_attribute_name(m_parser, att, m_env), "mustUnderstand");
+    ASSERT_STREQ(guththila_get_attribute_value(m_parser, att, m_env), "0");
+
+    count = 0;
+    while(!count)
+    {
+        /* FIXME:  This is potentially an infinite loop */
+        c = guththila_next(m_parser, m_env);
+        count = guththila_get_attribute_count(m_parser, m_env);
+        if (count)
+            att = guththila_get_attribute(m_parser, m_env);
+    }
+    ASSERT_NE(count, 0);
+    ASSERT_STREQ(guththila_get_attribute_prefix(m_parser, att, m_env), "soapenv");
+    ASSERT_STREQ(guththila_get_attribute_name(m_parser, att, m_env), "mustUnderstand");
+    ASSERT_STREQ(guththila_get_attribute_value(m_parser, att, m_env), "0");
+
+}
diff --git a/guththila/tests/test_guththila.cc b/guththila/tests/test_guththila.cc
new file mode 100644
index 0000000..1bb3b32
--- /dev/null
+++ b/guththila/tests/test_guththila.cc
@@ -0,0 +1,221 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <gtest/gtest.h>
+
+#include <guththila.h>
+#include "guththila_defines.h"
+
+#define BUF_SIZE 256
+
+class TestGuththila: public ::testing::Test
+{
+
+    protected:
+        void SetUp()
+        {
+            m_allocator = axutil_allocator_init(NULL);
+            ASSERT_NE(m_allocator, nullptr);
+            m_env = axutil_env_create(m_allocator);
+            ASSERT_NE(m_env, nullptr);
+
+            m_parser = (guththila_t*) calloc(1, sizeof(guththila_t));
+            ASSERT_NE(m_parser, nullptr);
+
+            memset(m_buffer, 0, BUF_SIZE);
+
+        }
+
+        void TearDown()
+        {
+            guththila_reader_free(m_reader, m_env);
+            m_reader = nullptr;
+            guththila_un_init(m_parser, m_env);
+            m_parser = nullptr;
+            axutil_env_free(m_env);
+
+        }
+
+        axutil_allocator_t *m_allocator;
+        axutil_env_t *m_env;
+        guththila_reader_t *m_reader;
+        guththila_t *m_parser;
+        char m_buffer[BUF_SIZE];
+
+};
+
+
+TEST_F(TestGuththila, test_start_element) {
+
+    int c = 0;
+    char *p;
+
+    m_reader = guththila_reader_create_for_file("resources/om/axis.xml", m_env);
+    ASSERT_NE(m_reader, nullptr);
+    guththila_init(m_parser, m_reader, m_env);
+
+    guththila_reader_read(m_parser->reader, m_buffer, 0, BUF_SIZE,  m_env);
+    c = guththila_next(m_parser, m_env);
+
+    while((c != GUTHTHILA_START_ELEMENT))
+        c = guththila_next(m_parser, m_env);
+
+    p = guththila_get_name(m_parser, m_env);
+    ASSERT_NE(p, nullptr);
+    ASSERT_EQ(c, GUTHTHILA_START_ELEMENT);
+    ASSERT_STREQ(p, "root");
+    c = 0;
+
+    while((c != GUTHTHILA_START_ELEMENT))
+        c = guththila_next(m_parser, m_env);
+
+    p = guththila_get_name(m_parser, m_env);
+    ASSERT_NE(p, nullptr);
+    ASSERT_EQ(c, GUTHTHILA_START_ELEMENT);
+    ASSERT_STREQ(p, "a");
+
+    c = 0;
+    while((c != GUTHTHILA_START_ELEMENT))
+        c = guththila_next(m_parser, m_env);
+
+    p = guththila_get_name(m_parser, m_env);
+    ASSERT_NE(p, nullptr);
+    ASSERT_STREQ(p, "b");
+}
+
+TEST_F(TestGuththila, test_empty_element) {
+
+    int c = 0;
+    char *p;
+
+    m_reader = guththila_reader_create_for_file("resources/om/axis.xml", m_env);
+    ASSERT_NE(m_reader, nullptr);
+    guththila_init(m_parser, m_reader, m_env);
+
+    guththila_reader_read(m_parser->reader, m_buffer, 0, BUF_SIZE,  m_env);
+    c = guththila_next(m_parser, m_env);
+
+    while((c != GUTHTHILA_EMPTY_ELEMENT))
+        c = guththila_next(m_parser, m_env);
+
+    p = guththila_get_name(m_parser, m_env);
+    ASSERT_NE(p, nullptr);
+
+    ASSERT_EQ(c, GUTHTHILA_EMPTY_ELEMENT);
+    ASSERT_STREQ(p, "a.1");
+
+    c = 0;
+
+    while((c != GUTHTHILA_EMPTY_ELEMENT))
+        c = guththila_next(m_parser, m_env);
+
+    p = guththila_get_name(m_parser, m_env);
+    ASSERT_NE(p, nullptr);
+
+    ASSERT_EQ(c, GUTHTHILA_EMPTY_ELEMENT);
+    ASSERT_STREQ(p, "a.2");
+
+    c = 0;
+    while((c != GUTHTHILA_START_ELEMENT))
+        c = guththila_next(m_parser, m_env);
+
+    c = 0;
+    while((c != GUTHTHILA_EMPTY_ELEMENT))
+        c = guththila_next(m_parser, m_env);
+
+    p = guththila_get_name(m_parser, m_env);
+    ASSERT_NE(p, nullptr);
+
+    ASSERT_EQ(c, GUTHTHILA_EMPTY_ELEMENT);
+    ASSERT_STREQ(p, "b.1");
+
+}
+
+
+TEST_F(TestGuththila, test_end_element) {
+
+    int c = 0;
+    char *p;
+
+    m_reader = guththila_reader_create_for_file("resources/om/axis.xml", m_env);
+    ASSERT_NE(m_reader, nullptr);
+    guththila_init(m_parser, m_reader, m_env);
+
+    guththila_reader_read(m_parser->reader, m_buffer, 0, BUF_SIZE,  m_env);
+    c = guththila_next(m_parser, m_env);
+
+    while((c != GUTHTHILA_END_ELEMENT))
+        c = guththila_next(m_parser, m_env);
+
+    p = guththila_get_name(m_parser, m_env);
+    ASSERT_NE(p, nullptr);
+
+    ASSERT_EQ(c, GUTHTHILA_END_ELEMENT);
+    ASSERT_STREQ(p, "a");
+
+    c = 0;
+    while((c != GUTHTHILA_END_ELEMENT))
+        c = guththila_next(m_parser, m_env);
+
+    p = guththila_get_name(m_parser, m_env);
+    ASSERT_NE(p, nullptr);
+
+    ASSERT_EQ(c, GUTHTHILA_END_ELEMENT);
+    ASSERT_STREQ(p, "b");
+
+    c = 0;
+    while((c != GUTHTHILA_END_ELEMENT))
+        c = guththila_next(m_parser, m_env);
+
+    p = guththila_get_name(m_parser, m_env);
+    ASSERT_NE(p, nullptr);
+
+    ASSERT_EQ(c, GUTHTHILA_END_ELEMENT);
+    ASSERT_STREQ(p, "root");
+}
+
+TEST_F(TestGuththila, test_character) {
+
+    int c = 0;
+    int i = 0;
+    char *p;
+
+    m_reader = guththila_reader_create_for_file("resources/om/numbers.xml", m_env);
+    ASSERT_NE(m_reader, nullptr);
+    guththila_init(m_parser, m_reader, m_env);
+
+    guththila_reader_read(m_parser->reader, m_buffer, 0, BUF_SIZE,  m_env);
+    c = guththila_next(m_parser, m_env);
+    while(i < 3)
+    {
+        if(c == GUTHTHILA_START_ELEMENT)
+            i++;
+        c = guththila_next(m_parser, m_env);
+    }
+
+    if(c == GUTHTHILA_CHARACTER)
+        p = guththila_get_value(m_parser, m_env);
+    ASSERT_NE(p, nullptr);
+    ASSERT_STREQ(p, "3");
+
+    c = 0;
+    while(c != GUTHTHILA_CHARACTER)
+        c = guththila_next(m_parser, m_env);
+    p = guththila_get_value(m_parser, m_env);
+    ASSERT_NE(p, nullptr);
+    ASSERT_STREQ(p, "24");
+}