1 // Copyright 2011 Juri Glass, Mathias Runge, Nadim El Sayed
2 // DAI-Labor, TU-Berlin
3 //
4 // This file is part of libSML.
5 //
6 // libSML is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // libSML is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with libSML.  If not, see <http://www.gnu.org/licenses/>.
18 
19 #include "../unity/unity_fixture.h"
20 #include "test_helper.h"
21 #include <sml/sml_get_profile_pack_request.h>
22 
23 TEST_GROUP(sml_get_profile_pack_request);
24 
25 extern sml_buffer *buf;
26 
TEST_SETUP(sml_get_profile_pack_request)27 TEST_SETUP(sml_get_profile_pack_request) {
28 	buf = sml_buffer_init(512);
29 }
30 
TEST_TEAR_DOWN(sml_get_profile_pack_request)31 TEST_TEAR_DOWN(sml_get_profile_pack_request) {
32 	sml_buffer_free(buf);
33 }
34 
TEST(sml_get_profile_pack_request,init)35 TEST(sml_get_profile_pack_request, init) {
36 	sml_get_profile_pack_request *r = sml_get_profile_pack_request_init();
37 	TEST_ASSERT_NOT_NULL(r);
38 	sml_get_profile_pack_request_free( r );
39 }
40 
TEST(sml_get_profile_pack_request,parse)41 TEST(sml_get_profile_pack_request, parse) {
42 	hex2binary("7901010101010101730648616C6C6F0648616C6C6F0648616C6C6F01", sml_buf_get_current_buf(buf));
43 	sml_get_profile_pack_request *r = sml_get_profile_pack_request_parse(buf);
44 	TEST_ASSERT_NOT_NULL(r);
45 	TEST_ASSERT_NOT_NULL(r->object_list);
46 	TEST_ASSERT_NOT_NULL(r->object_list->next);
47 	TEST_ASSERT_NOT_NULL(r->object_list->next->next);
48 	TEST_ASSERT_NULL(r->object_list->next->next->next);
49 	sml_get_profile_pack_request_free( r );
50 }
51 
TEST_GROUP_RUNNER(sml_get_profile_pack_request)52 TEST_GROUP_RUNNER(sml_get_profile_pack_request) {
53 	RUN_TEST_CASE(sml_get_profile_pack_request, init);
54 	RUN_TEST_CASE(sml_get_profile_pack_request, parse);
55 }
56 
57