From fc54f29a15f4400f7c7848ea696f66ffb0960967 Mon Sep 17 00:00:00 2001 From: Juri Glass Date: Mon, 18 Jul 2011 14:17:40 +0200 Subject: [PATCH] first sml_list test --- sml/src/sml_list.c | 2 -- test/Makefile | 1 + test/src/sml_list_test.c | 42 ++++++++++++++++++++++++++++++++++++++++ test/test_main.c | 1 + 4 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 test/src/sml_list_test.c diff --git a/sml/src/sml_list.c b/sml/src/sml_list.c index 2d6e611..48d430a 100644 --- a/sml/src/sml_list.c +++ b/sml/src/sml_list.c @@ -26,8 +26,6 @@ #include - - sml_list *sml_list_init(){ sml_list *s = (sml_list *)malloc(sizeof(sml_list)); memset(s, 0, sizeof(sml_list)); diff --git a/test/Makefile b/test/Makefile index 0f232bb..e8c71a6 100644 --- a/test/Makefile +++ b/test/Makefile @@ -13,6 +13,7 @@ OBJS = \ src/sml_boolean_test.o \ src/sml_value_test.o \ src/sml_status_test.o \ + src/sml_list_test.o \ src/sml_file_test.o \ src/sml_message_test.o diff --git a/test/src/sml_list_test.c b/test/src/sml_list_test.c new file mode 100644 index 0000000..7ff1879 --- /dev/null +++ b/test/src/sml_list_test.c @@ -0,0 +1,42 @@ +// Copyright 2011 Juri Glass, Mathias Runge, Nadim El Sayed +// DAI-Labor, TU-Berlin +// +// This file is part of libSML. +// +// libSML is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// libSML is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with libSML. If not, see . + +#include "../unity/unity_fixture.h" +#include "test_helper.h" +#include + +TEST_GROUP(sml_list); + +sml_buffer *buf; + +TEST_SETUP(sml_list) { + buf = sml_buffer_init(512); +} + +TEST_TEAR_DOWN(sml_list) { + sml_buffer_free(buf); +} + +TEST(sml_list, init) { + sml_list *v = sml_list_init(); + TEST_ASSERT_NOT_NULL(v); +} + +TEST_GROUP_RUNNER(sml_list) { + RUN_TEST_CASE(sml_list, init); +} diff --git a/test/test_main.c b/test/test_main.c index a188db1..0cf8a40 100644 --- a/test/test_main.c +++ b/test/test_main.c @@ -25,6 +25,7 @@ static void runAllTests() { RUN_TEST_GROUP(sml_boolean); RUN_TEST_GROUP(sml_value); RUN_TEST_GROUP(sml_status); + RUN_TEST_GROUP(sml_list); RUN_TEST_GROUP(sml_message); RUN_TEST_GROUP(sml_file); }