Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/openlaunchd
Path: blob/master/liblaunch/test/getter_tests.c
374 views
1
/*
2
* Copyright (c) 2013 R. Tyler Croy, All rights reserved.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*
16
*/
17
18
#include "liblaunch_test.h"
19
20
/*
21
* TEST: launch_data_get_errno
22
*****************************************************/
23
void test_launch_data_get_errno_null(void **state) {
24
launch_data_t d = NULL;
25
assert_int_equal(0, launch_data_get_errno(d));
26
};
27
28
void test_launch_data_get_errno(void **state) {
29
struct _launch_data d;
30
d.err = 4;
31
assert_int_equal(4, launch_data_get_errno(&d));
32
}
33
/*****************************************************/
34
35
/* TEST: launch_data_get_fd
36
*****************************************************/
37
void test_launch_data_get_fd_null(void **state) {
38
launch_data_t d = NULL;
39
assert_int_equal(0, launch_data_get_fd(d));
40
};
41
42
/* TEST: launch_data_get_integer
43
*****************************************************/
44
void test_launch_data_get_integer_null(void **state) {
45
launch_data_t d = NULL;
46
assert_true(0 == launch_data_get_integer(d));
47
}
48
49
void test_launch_data_get_integer(void **state) {
50
struct _launch_data d;
51
d.number = 7;
52
assert_true(7 == launch_data_get_integer(&d));
53
};
54
/*****************************************************/
55
56
57
/* TEST: launch_data_get_bool
58
*****************************************************/
59
void test_launch_data_get_bool_default(void **state) {
60
struct _launch_data d;
61
assert_true(launch_data_get_bool(&d));
62
};
63
64
void test_launch_data_get_bool_false(void **state) {
65
struct _launch_data d;
66
d.boolean = false;
67
assert_false(launch_data_get_bool(&d));
68
};
69
/*****************************************************/
70
71