1 //===-- flang/unittests/RuntimeGTest/CommandTest.cpp ----------------------===// 2 // 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 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "../../runtime/command.h" 10 #include "gtest/gtest.h" 11 #include "../../runtime/descriptor.h" 12 #include "../../runtime/main.h" 13 14 using namespace Fortran::runtime; 15 16 TEST(ArgumentCount, ZeroArguments) { 17 const char *argv[]{"aProgram"}; 18 RTNAME(ProgramStart)(1, argv, {}); 19 EXPECT_EQ(0, RTNAME(ArgumentCount)()); 20 } 21 22 TEST(ArgumentCount, OneArgument) { 23 const char *argv[]{"aProgram", "anArgument"}; 24 RTNAME(ProgramStart)(2, argv, {}); 25 EXPECT_EQ(1, RTNAME(ArgumentCount)()); 26 } 27 28 TEST(ArgumentCount, SeveralArguments) { 29 const char *argv[]{"aProgram", "arg1", "arg2", "arg3", "arg4"}; 30 RTNAME(ProgramStart)(5, argv, {}); 31 EXPECT_EQ(4, RTNAME(ArgumentCount)()); 32 } 33