Branch data Line data Source code
1 : : /*
2 : : * Copyright (C) 2010, 2012 Joel Rosdahl
3 : : *
4 : : * This program is free software; you can redistribute it and/or modify it
5 : : * under the terms of the GNU General Public License as published by the Free
6 : : * Software Foundation; either version 3 of the License, or (at your option)
7 : : * any later version.
8 : : *
9 : : * This program is distributed in the hope that it will be useful, but WITHOUT
10 : : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 : : * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 : : * more details.
13 : : *
14 : : * You should have received a copy of the GNU General Public License along with
15 : : * this program; if not, write to the Free Software Foundation, Inc., 51
16 : : * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 : : */
18 : :
19 : : /*
20 : : * This file contains tests for the compopt_* functions.
21 : : */
22 : :
23 : : #include "ccache.h"
24 : : #include "compopt.h"
25 : : #include "test/framework.h"
26 : :
27 : 1 : TEST_SUITE(compopt)
28 : :
29 [ + - ]: 1 : TEST(option_table_should_be_sorted)
30 : : {
31 : : bool compopt_verify_sortedness();
32 [ + - ]: 1 : CHECK(compopt_verify_sortedness());
33 : : }
34 : :
35 [ + - ]: 1 : TEST(dash_I_affects_cpp)
36 : : {
37 [ + - ]: 1 : CHECK(compopt_affects_cpp("-I"));
38 [ + - ]: 1 : CHECK(!compopt_affects_cpp("-Ifoo"));
39 : : }
40 : :
41 [ + - ]: 1 : TEST(compopt_short)
42 : : {
43 [ + - ]: 1 : CHECK(compopt_short(compopt_affects_cpp, "-Ifoo"));
44 [ + - ]: 1 : CHECK(!compopt_short(compopt_affects_cpp, "-include"));
45 : : }
46 : :
47 [ + - ]: 1 : TEST(dash_V_doesnt_affect_cpp)
48 : : {
49 [ + - ]: 1 : CHECK(!compopt_affects_cpp("-V"));
50 : : }
51 : :
52 [ + - ]: 1 : TEST(dash_doesnexist_doesnt_affect_cpp)
53 : : {
54 [ + - ]: 1 : CHECK(!compopt_affects_cpp("-doesntexist"));
55 : : }
56 : :
57 [ + - ]: 1 : TEST(dash_MM_too_hard)
58 : : {
59 [ + - ]: 1 : CHECK(compopt_too_hard("-MM"));
60 : : }
61 : :
62 [ + - ]: 1 : TEST(dash_MD_not_too_hard)
63 : : {
64 [ + - ]: 1 : CHECK(!compopt_too_hard("-MD"));
65 : : }
66 : :
67 [ + - ]: 1 : TEST(dash_fprofile_arcs_not_too_hard)
68 : : {
69 [ + - ]: 1 : CHECK(!compopt_too_hard("-fprofile-arcs"));
70 : : }
71 : :
72 [ + - ]: 1 : TEST(dash_ftest_coverage_not_too_hard)
73 : : {
74 [ + - ]: 1 : CHECK(!compopt_too_hard("-ftest-coverage"));
75 : : }
76 : :
77 [ + - ]: 1 : TEST(dash_doesnexist_not_too_hard)
78 : : {
79 [ + - ]: 1 : CHECK(!compopt_too_hard("-doesntexist"));
80 : : }
81 : :
82 [ + - ]: 1 : TEST(dash_Xpreprocessor_too_hard_for_direct_mode)
83 : : {
84 [ + - ]: 1 : CHECK(compopt_too_hard_for_direct_mode("-Xpreprocessor"));
85 : : }
86 : :
87 [ + - ]: 1 : TEST(dash_nostdinc_not_too_hard_for_direct_mode)
88 : : {
89 [ + - ]: 1 : CHECK(!compopt_too_hard_for_direct_mode("-nostdinc"));
90 : : }
91 : :
92 [ + - ]: 1 : TEST(dash_I_takes_path)
93 : : {
94 [ + - ]: 1 : CHECK(compopt_takes_path("-I"));
95 : : }
96 : :
97 [ + - ]: 1 : TEST(dash_Xlinker_takes_arg)
98 : : {
99 [ + - ]: 1 : CHECK(compopt_takes_arg("-Xlinker"));
100 : : }
101 : :
102 [ + - ]: 1 : TEST(dash_xxx_doesnt_take_arg)
103 : : {
104 [ + - ]: 1 : CHECK(!compopt_takes_arg("-xxx"));
105 : : }
106 : :
107 [ + - ]: 1 : TEST(dash_iframework_prefix_affects_cpp)
108 : : {
109 [ + - ]: 1 : CHECK(compopt_prefix_affects_cpp("-iframework"));
110 : : }
111 : :
112 : 1 : TEST_SUITE_END
|