1 //===-- Loader test to check args to main ---------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "test/IntegrationTest/test.h"
11 static bool my_streq(const char *lhs
, const char *rhs
) {
13 for (l
= lhs
, r
= rhs
; *l
!= '\0' && *r
!= '\0'; ++l
, ++r
)
17 return *l
== '\0' && *r
== '\0';
20 TEST_MAIN(int argc
, char **argv
, char **envp
) {
21 ASSERT_TRUE(argc
== 4);
22 ASSERT_TRUE(my_streq(argv
[1], "1"));
23 ASSERT_TRUE(my_streq(argv
[2], "2"));
24 ASSERT_TRUE(my_streq(argv
[3], "3"));
26 bool found_france
= false;
27 bool found_germany
= false;
28 for (; *envp
!= nullptr; ++envp
) {
29 if (my_streq(*envp
, "FRANCE=Paris"))
31 if (my_streq(*envp
, "GERMANY=Berlin"))
35 ASSERT_TRUE(found_france
&& found_germany
);