diff --git a/sml/src/sml_value.c b/sml/src/sml_value.c
index 141b16e..bd5e2d4 100644
--- a/sml/src/sml_value.c
+++ b/sml/src/sml_value.c
@@ -32,6 +32,9 @@ sml_value *sml_value_parse(sml_buffer *buf) {
case SML_TYPE_OCTET_STRING:
value->data.bytes = sml_octet_string_parse(buf);
break;
+ case SML_TYPE_BOOLEAN:
+ value->data.boolean = sml_boolean_parse(buf);
+ break;
case SML_TYPE_UNSIGNED:
switch (byte & SML_LENGTH_FIELD) {
case SML_TYPE_NUMBER_8:
diff --git a/test/Makefile b/test/Makefile
index c060926..f58e303 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -11,6 +11,7 @@ OBJS = \
src/sml_buffer_test.o \
src/sml_number_test.o \
src/sml_boolean_test.o \
+ src/sml_value_test.o \
src/sml_file_test.o \
src/sml_message_test.o
diff --git a/test/src/sml_value_test.c b/test/src/sml_value_test.c
new file mode 100644
index 0000000..cb269ba
--- /dev/null
+++ b/test/src/sml_value_test.c
@@ -0,0 +1,62 @@
+// 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_value);
+
+sml_buffer *buf;
+
+TEST_SETUP(sml_value) {
+ buf = sml_buffer_init(512);
+}
+
+TEST_TEAR_DOWN(sml_value) {
+ sml_buffer_free(buf);
+}
+
+TEST(sml_value, init) {
+ sml_value *v = sml_value_init();
+ TEST_ASSERT_NOT_NULL(v);
+}
+
+TEST(sml_value, parse_octet_string) {
+ hex2binary("0648616C6C6F", sml_buf_get_current_buf(buf));
+ sml_value *v = sml_value_parse(buf);
+
+ TEST_ASSERT_NOT_NULL(v);
+ TEST_ASSERT_EQUAL(SML_TYPE_OCTET_STRING, v->type);
+ expected_octet_string(v->data.bytes, "Hallo", 5);
+}
+
+TEST(sml_value, parse_boolean) {
+ hex2binary("4200", sml_buf_get_current_buf(buf));
+ sml_value *v = sml_value_parse(buf);
+
+ TEST_ASSERT_NOT_NULL(v);
+ TEST_ASSERT_EQUAL(SML_TYPE_BOOLEAN, v->type);
+ TEST_ASSERT_FALSE(*(v->data.boolean));
+}
+
+TEST_GROUP_RUNNER(sml_value) {
+ RUN_TEST_CASE(sml_value, init);
+ RUN_TEST_CASE(sml_value, parse_octet_string);
+ RUN_TEST_CASE(sml_value, parse_boolean);
+}
diff --git a/test/test_main.c b/test/test_main.c
index 23d52d1..a57377d 100644
--- a/test/test_main.c
+++ b/test/test_main.c
@@ -23,6 +23,7 @@ static void runAllTests() {
RUN_TEST_GROUP(sml_buffer);
RUN_TEST_GROUP(sml_number);
RUN_TEST_GROUP(sml_boolean);
+ RUN_TEST_GROUP(sml_value);
RUN_TEST_GROUP(sml_message);
RUN_TEST_GROUP(sml_file);
}