resetting manifest requested domain to floor
[platform/upstream/ccache.git] / test / test_compopt.c
1 /*
2  * Copyright (C) 2010 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 TEST_SUITE(compopt)
28
29 TEST(option_table_should_be_sorted)
30 {
31         bool compopt_verify_sortedness();
32         CHECK(compopt_verify_sortedness());
33 }
34
35 TEST(dash_I_affects_cpp)
36 {
37         CHECK(compopt_affects_cpp("-I"));
38         CHECK(!compopt_affects_cpp("-Ifoo"));
39 }
40
41 TEST(compopt_short)
42 {
43         CHECK(compopt_short(compopt_affects_cpp, "-Ifoo"));
44         CHECK(!compopt_short(compopt_affects_cpp, "-include"));
45 }
46
47 TEST(dash_V_doesnt_affect_cpp)
48 {
49         CHECK(!compopt_affects_cpp("-V"));
50 }
51
52 TEST(dash_doesnexist_doesnt_affect_cpp)
53 {
54         CHECK(!compopt_affects_cpp("-doesntexist"));
55 }
56
57 TEST(dash_MM_too_hard)
58 {
59         CHECK(compopt_too_hard("-MM"));
60 }
61
62 TEST(dash_MD_not_too_hard)
63 {
64         CHECK(!compopt_too_hard("-MD"));
65 }
66
67 TEST(dash_doesnexist_not_too_hard)
68 {
69         CHECK(!compopt_too_hard("-doesntexist"));
70 }
71
72 TEST(dash_Xpreprocessor_too_hard_for_direct_mode)
73 {
74         CHECK(compopt_too_hard_for_direct_mode("-Xpreprocessor"));
75 }
76
77 TEST(dash_nostdinc_not_too_hard_for_direct_mode)
78 {
79         CHECK(!compopt_too_hard_for_direct_mode("-nostdinc"));
80 }
81
82 TEST(dash_I_takes_path)
83 {
84         CHECK(compopt_takes_path("-I"));
85 }
86
87 TEST(dash_Xlinker_takes_arg)
88 {
89         CHECK(compopt_takes_arg("-Xlinker"));
90 }
91
92 TEST(dash_xxx_doesnt_take_arg)
93 {
94         CHECK(!compopt_takes_arg("-xxx"));
95 }
96
97 TEST_SUITE_END