Tool that generates unit test by C/C++ source code, trying to reach all branches and maximize code coverage

What is UTBotCpp?

UTBotCpp generates test cases by code, trying to cover maximum statements and execution paths. We treat source code as source of truth assuming that behavior is correct and corresponds to initial user demand. Generated tests are placed in so-called regression suite. Thus, we fixate current behavior by generated test cases. Using UTBotCpp developers obtain full control of their code. No future change can break the code without being noticed once it's covered with tests generated by UTBot. This way, modifications made by developers to an existing code are much safer. Hence, with the help of generated unit tests, UTBot provides dramatic code quality improvement.

How to install and use UTBot

For now, you can only use UTBot under Ubuntu. UTBot has been tested under Ubuntu 14, 16, and 18. Navigate to the Releases GitHub page and download any version of UTBot. UTBot is distrbuted as an archive that contains

  1. A pack utbot_distr.tar.gz that contains UTBot binary and its dependencies;
  2. UTBot plugin for Visual Studio code — utbot_plugin.vsix;
  3. A version version.txt;
  4. A run script unpack_and_run_utbot.sh.

To launch UTBot, unzip the archive and run the chmod +x unpack_and_run_utbot.sh && ./unpack_and_run_utbot.sh command (we recommend doing it in a fresh directory to make UTBot removing easier). To remove UTBot, simply delete this directory.

To install UTBot VSCode plugin, use VSCode Install from VSIX command.

How to contribute to UTBot

See DEVNOTE.md.

Comments
  • Better structure fields initialization in generated tests

    Better structure fields initialization in generated tests

    We need the option to transform initialization from initialization-list-based way

        {0, 0, 
          {1, 2}, 
          {1, 2, 3}, 
          0, 0, 0, 
          {4,5,{3,3}}}
    

    to struct-field-based:

    structA.x = 0;
    structA.y = 0;
    structA.subStru.m = 1;
    structA.subStru.n = 2;
    ...
    

    Seems like it should be a UI option in the formatting settings.

  • Test runner in batch mode failed

    Test runner in batch mode failed

    Steps to reproduce:

    1. Configure project libbacktrace
    2. Generate tests for file elf.c
    3. Run any regression test individually, it must be passed and an icon showed up
    4. Run all tests in file at once, no icons showed
    5. Check logs
    2022-04-11 10:42:20.166 [utbot-64TK      ]        GTestLogger.cpp:10    INFO| Running main() from /utbot_distr/gtest/googletest/src/gtest_main.cc
    Note: Google Test filter = *.elf_zlib_inflate_table_test_1
    [==========] Running 1 test from 1 test suite.
    [----------] Global test environment set-up.
    [----------] 1 test from error
    [ RUN      ] error.elf_zlib_inflate_table_test_1
    AddressSanitizer:DEADLYSIGNAL
    =================================================================
    ==11372==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x000000000000 bp 0x000000000000 sp 0x7fffffffdee0 T0)
    ==11372==Hint: pc points to the zero page.
    ==11372==The signal is caused by a READ memory access.
    ==11372==Hint: address points to the zero page.
        #0 0x0  (<unknown module>)
        #1 0x7ffff7bc697f  (/lib/x86_64-linux-gnu/libpthread.so.0+0x1297f)
    
    AddressSanitizer can not provide additional info.
    SUMMARY: AddressSanitizer: SEGV (<unknown module>) 
    ==11372==ABORTING
    /home/utbot/projects/libbacktrace/build/utbot/make/elf.mk:79: recipe for target 'run' failed
    make: *** [run] Error 1
    
    2022-04-11 10:42:20.166 [utbot-64TK      ]         TestRunner.cpp:154      1| All run commands were executed
    2022-04-11 10:42:20.167 [utbot-64TK      ]   LlvmCoverageTool.cpp:69    WARN| All profraw files are empty: /home/utbot/tmp/utbot-64TK/libbacktrace/coverage/lcov/elf_zlib_inflate_table_test_1.profraw
    2022-04-11 10:42:20.167 [utbot-64TK      ]ServerCoverageAndResult:24    INFO| Creating coverage response.
    2022-04-11 10:42:20.167 [utbot-64TK      ]ServerCoverageAndResult:58    INFO| Coverage response generated
    2022-04-11 10:42:20.167 [utbot-64TK      ] TimeExecStatistics.cpp:117      1| Time execution statistic report:
     | __________________________________________________ | ____________ | _______________ | ____________ | 
     |                                           Function | % of overall | Total time (ms) | Times called | 
     | __________________________________________________ | ____________ | _______________ | ____________ | 
     | CoverageAndResultsGenerator.cpp:37        generate |       100.00 |             227 |            1 | 
     | TestRunner.cpp:159                            init |        56.83 |             129 |            1 | 
     | TestRunner.cpp:135                        runTests |        42.73 |              97 |            1 | 
     | LlvmCoverageTool.cpp:54        getCoverageCommands |         0.00 |               0 |            1 | 
     | CoverageAndResultsGenerator.cpp:86 collectCoverage |         0.00 |               0 |            1 | 
     | __________________________________________________ | ____________ | _______________ | ____________ |
    
  • Add interactive mode

    Add interactive mode

    Now interactive mode doesn't work on generation tests for project or folder, but for file all are fine. For file linked-list.cpp generation time equals 52s for 1 parallel process, 36s - for 5 and 20s - for 10. For other files it's impossible to see difference because number of functions in files are small

  • "Couldn't link any file" error when generating tests for project

    Version v1.0.31-alpha Test project

    Steps to reproduce:

    1. Select lib folder
    2. Right click -> UTbot: Generate Tests for Project

    Actual -> FAILED_PRECONDITION: Couldn't link any files LinkError LinkError0 Expected -> Test should be generated

  • [KLEE] Assertion in lazy instantiation failed

    [KLEE] Assertion in lazy instantiation failed

    Steps to reproduce:

    1. Configure project libbacktrace
    2. Generate tests for function elf_zlib_inflate_table in file dwarf.c
    3. Find errors in logs
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   KLEE: ERROR: elf.c:1268: memory error: out of bound pointer
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   KLEE: NOTE: now ignoring this error at this location
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   utbot: ../lib/Core/Executor.cpp:4880: klee::ObjectPair klee::Executor::lazyInstantiateVariable(klee::ExecutionState &, ref<klee::Expr>, klee::KInstruction *, uint64_t): Assertion `!isa<ConstantExpr>(address)' failed.
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   linux-gnu/libpthread.so.0+0x12980)
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .    #4 0x00007ffff46fae87 raise (/lib/x86_64-linux-gnu/libc.so.6+0x3ee87)
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .    #5 0x00007ffff46fc7f1 abort (/lib/x86_64-linux-gnu/libc.so.6+0x407f1)
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .    #6 0x00007ffff46ec3fa (/lib/x86_64-linux-gnu/libc.so.6+0x303fa)
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .    #7 0x00007ffff46ec472 (/lib/x86_64-linux-gnu/libc.so.6+0x30472)
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .    #8 0x00000000032a5062 klee::Executor::lazyInstantiateVariable(klee::ExecutionState&, klee::ref<klee::Expr>, klee::KInstruction*, unsigned long) /home/utbot/UTBotCpp/submodules/klee/build/../lib/Core/Executor.cpp:0:3
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .    #9 0x00000000032968be klee::Executor::executeMemoryOperation(klee::ExecutionState&, klee::Executor::MemoryOperation, klee::ref<klee::Expr>, klee::ref<klee::Expr>, klee::KInstruction*) /home/utbot/UTBotCpp/submodules/klee/build/../lib/Core/Executor.cpp:0:0
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #10 0x000000000329911f klee::ref<klee::Expr>::dec() const /home/utbot/UTBotCpp/submodules/klee/build/../include/klee/ADT/Ref.h:98:9
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #11 0x000000000329911f klee::ref<klee::Expr>::~ref() /home/utbot/UTBotCpp/submodules/klee/build/../include/klee/ADT/Ref.h:89:13
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #12 0x000000000329911f klee::Executor::executeInstruction(klee::ExecutionState&, klee::KInstruction*) /home/utbot/UTBotCpp/submodules/klee/build/../lib/Core/Executor.cpp:2845:5
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #13 0x00000000032a1d45 klee::Executor::executeStep(klee::ExecutionState&) /home/utbot/UTBotCpp/submodules/klee/build/../lib/Core/Executor.cpp:3874:3
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #14 0x00000000032a27db klee::Executor::guidedRun(klee::ExecutionState&) /home/utbot/UTBotCpp/submodules/klee/build/../lib/Core/Executor.cpp:4011:13
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #15 0x00000000032a2516 std::enable_if<__and_<std::__not_<std::__is_tuple_like<klee::PTree*> >, std::is_move_constructible<klee::PTree*>, std::is_move_assignable<klee::PTree*> >::value, void>::type std::swap<klee::PTree*>(klee::PTree*&, klee::PTree*&) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/move.h:193:19
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #16 0x00000000032a2516 std::unique_ptr<klee::PTree, std::default_delete<klee::PTree> >::reset(klee::PTree*) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/unique_ptr.h:400:2
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #17 0x00000000032a2516 std::unique_ptr<klee::PTree, std::default_delete<klee::PTree> >::operator=(std::nullptr_t) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/unique_ptr.h:336:2
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #18 0x00000000032a2516 klee::Executor::runGuided(klee::ExecutionState&, klee::KFunction*) /home/utbot/UTBotCpp/submodules/klee/build/../lib/Core/Executor.cpp:3855:15
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #19 0x00000000032a71e9 klee::Executor::runMainAsGuided(llvm::Function*, int, char**, char**) /home/utbot/UTBotCpp/submodules/klee/build/../lib/Core/Executor.cpp:5163:1
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #20 0x000000000327f0b8 __gnu_cxx::__normal_iterator<KTest* const*, std::vector<KTest*, std::allocator<KTest*> > >::__normal_iterator(KTest* const* const&) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_iterator.h:804:20
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #21 0x000000000327f0b8 std::vector<KTest*, std::allocator<KTest*> >::begin() const /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_vector.h:818:16
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #22 0x000000000327f0b8 std::vector<KTest*, std::allocator<KTest*> >::empty() const /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_vector.h:1005:16
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #23 0x000000000327f0b8 run_klee_on_function(int, char**, char**, std::unique_ptr<KleeHandler, std::default_delete<KleeHandler> >&, std::unique_ptr<klee::Interpreter, std::default_delete<klee::Interpreter> >&, llvm::Module*, std::vector<bool, std::allocator<bool> >&, std::vector<std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> >, std::allocator<std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> > > >&) /home/utbot/UTBotCpp/submodules/klee/build/../lib/Runner/run_klee.cpp:1554:19
    
  • release version 1.0.167 : error occur in kleeRunner

    release version 1.0.167 : error occur in kleeRunner

    In latest docker env, I used CLI to generate testcases and set function-timeout: image But no testcases are generated. I run the klee command and print error: image

  • Optimization of VC UTBot Quickstart wizard

    Optimization of VC UTBot Quickstart wizard

    Optimization of Quickstart wizard to

    • minimize the actions from user side
    • extend diagnostic if possible
    • simplify the procedure for Windows client + WSL2 server case.
  • Incorrect capture of the empty macros from CMakeLists.txt setup

    Incorrect capture of the empty macros from CMakeLists.txt setup

    From discussion: https://github.com/UnitTestBot/UTBotJava/discussions/170

    minimal reproducer: main.cpp

    #include <iostream>
    
    int EXPORTS f(int a, int b) {
        return a + b;
    }
    int main () {
        std::cout << "awa!" << std::endl;
        return 1;
    } 
    

    CMakeLists.txt

    cmake_minimum_required(VERSION 3.20)
    project(example1)
    
    set(CMAKE_CXX_STANDARD 11)
    
    add_executable(example1 main.cpp)
    target_compile_definitions(example1 PUBLIC EXPORTS=)
    
  • Function that exits normally belongs to regression suite but makes the test fail

    Function that exits normally belongs to regression suite but makes the test fail

    Let's say we test a function that exits with status 0. In this case, the test belongs to the regression suite but makes it fail. Do you think it has to be Death test?

    image

  • Incomplete type of expected variable for 'void *' argument

    Incomplete type of expected variable for 'void *' argument

    Steps to reproduce

    1. Open and configure project coreutils
    2. Generate tests for gnulib/lib/free.c
    3. Try to run tests
    4. See logs

    Logs

    /home/utbot/projects/coreutils/utbot_tests/gnulib/lib/free_test.cpp:19:10: error: variable has incomplete type 'void'
        void expected_p = 0;
    

    Test

    TEST(error, rpl_free_test_1)
    {
        __attribute__ ((aligned(16))) unsigned char p = 0;
        rpl_free(&p);
        void expected_p = 0;
        EXPECT_EQ(expected_p, p);
    }
    

    Questions

    Should we check the pointer if it is freed? Should we check 'void *' output variables at all?

  • Invalid test generated with declared 'void' variable

    Invalid test generated with declared 'void' variable

    Project: libbpf File: libbpf/src/strset.c Function: strset__add_str Generated test:

    TEST(error, strset__add_str_test_5)
    {
        struct strset set = {NULL, 0UL, 10UL, 0UL, NULL};
        char s[] = "bcacbccccb";
        void utbotInnerVar1 = 0;
        set.strs_data = &utbotInnerVar1;
        set.strs_hash = &utbotInnerVar1;
        strset__add_str(&set, s);
        struct strset expected_set = {NULL, 0UL, 0UL, 0UL, NULL};
        EXPECT_EQ(expected_set.strs_data_len, set.strs_data_len);
        EXPECT_EQ(expected_set.strs_data_cap, set.strs_data_cap);
        EXPECT_EQ(expected_set.strs_data_max_len, set.strs_data_max_len);
    }
    

    Error:

    /home/utbot/projects/libbpf/tests/src/strset_test.cpp:67:10: error: variable has incomplete type 'void'
        void utbotInnerVar1 = 0;
    
  • [PERF] UTBot consumes CPU in spinlocks

    [PERF] UTBot consumes CPU in spinlocks

    Description utbot always high cpu

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    76423 root 20 0 326360 132448 53944 R 99.9 0.0 906:58.32 grpcpp_sync_ser
    77189 root 20 0 326360 132448 53944 R 99.7 0.0 906:47.70 grpcpp_sync_ser

    Thread 1 (process 77189): #0 0x00007feef3a02dd7 in sched_yield () from /root/data/utbot/utbot_distr/server-install/../lib/libc.so.6 #1 0x00000000010a82a9 in __gthread_yield () at /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9/bits/gthr-default.h:693 #2 yield () at /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/thread:356 #3 Server::TestsGenServiceImpl::provideLoggingCallbacks(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, grpc_impl::ServerWritertestsgen::LogEntry, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, void ()(void*, loguru::Message const&), std::map<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::atomic, std::less<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits, std::allocator > const, std::atomic > > >&, bool) (this=, callbackPrefix=..., writer=, logLevel=..., handler=0x10a7790 <Server::gtestLog(void*, loguru::Message const&)>, channelStorage=..., openFiles=false) at ../src/Server.cpp:415 #4 0x00000000010a881a in Server::TestsGenServiceImpl::OpenGTestChannel(grpc_impl::ServerContext*, testsgen::LogChannelRequest const*, grpc_impl::ServerWritertestsgen::LogEntry) (this=0x7ffe621671a0, context=, request=0x7780e70, writer=0x7feef3a02dd7 <sched_yield+7>) at ../src/Server.cpp:448 #5 0x00000000011bb3c6 in operator() (this=, service=0x7feef04b5290, ctx=0x13, req=0x7feef3a02dd7 <sched_yield+7>, writer=0x0) at protobuf/testgen.grpc.pb.cc:637 #6 std::_Function_handler<grpc::Status (testsgen::TestsGenService::Service, grpc_impl::ServerContext*, testsgen::LogChannelRequest const*, grpc_impl::ServerWritertestsgen::LogEntry), testsgen::TestsGenService::Service::ServerWriter()::$_4>::_M_invoke(std::_Any_data const&, testsgen::TestsGenService::Service&&, grpc_impl::ServerContext*&&, testsgen::LogChannelRequest const*&&, grpc_impl::ServerWritertestsgen::LogEntry&&) (__functor=..., __args=<unknown type in /root/data/utbot/utbot_distr/server-install/utbot, CU 0x2b5d3cb, DIE 0x2cfe3cf>, __args=<unknown type in /root/data/utbot/utbot_distr/server-install/utbot, CU 0x2b5d3cb, DIE 0x2cfe3cf>, __args=<unknown type in /root/data/utbot/utbot_distr/server-install/utbot, CU 0x2b5d3cb, DIE 0x2cfe3cf>, __args=<unknown type in /root/data/utbot/utbot_distr/server-install/utbot, CU 0x2b5d3cb, DIE 0x2cfe3cf>) at /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:285 #7 0x000000000120974e in operator() (this=0x8, __args=0x7feef04b5510, __args=0x7feef04b5510, __args=0x7feef04b5510, __args=0x7feef04b5510) at /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:688 #8 operator() (this=) at /utbot_distr/install/include/grpcpp/impl/codegen/method_handler_impl.h:191 #9 grpc_impl::internal::CatchingFunctionHandler<grpc_impl::internal::ServerStreamingHandler<testsgen::TestsGenService::Service, testsgen::LogChannelRequest, testsgen::LogEntry>::RunHandler(grpc::internal::MethodHandler::HandlerParameter const&)::{lambda()#1}>(grpc_impl::internal::ServerStreamingHandler<testsgen::TestsGenService::Service, testsgen::LogChannelRequest, testsgen::LogEntry>::RunHandler(grpc::internal::MethodHandler::HandlerParameter const&)::{lambda()#1}&&) (handler=) at /utbot_distr/install/include/grpcpp/impl/codegen/method_handler_impl.h:42 #10 0x0000000001208e6e in grpc_impl::internal::ServerStreamingHandler<testsgen::TestsGenService::Service, testsgen::LogChannelRequest, testsgen::LogEntry>::RunHandler(grpc::internal::MethodHandler::HandlerParameter const&) (this=0x765b590, param=...) at /utbot_distr/install/include/grpcpp/impl/codegen/method_handler_impl.h:190 #11 0x00000000025afddc in grpc_impl::Server::SyncRequest::CallData::ContinueRunAfterInterception() () #12 0x00000000025afbf7 in grpc_impl::Server::SyncRequest::CallData::Run(std::shared_ptr<grpc_impl::Server::GlobalCallbacks> const&, bool) () #13 0x00000000025b0359 in grpc_impl::Server::SyncRequestThreadManager::DoWork(void, bool, bool) () #14 0x00000000025c97b5 in grpc::ThreadManager::MainWorkLoop() () #15 0x00000000025c8d0b in grpc::ThreadManager::WorkerThread::Run() () #16 0x00000000025c8ba6 in ZZN4grpc13ThreadManager12WorkerThreadC4EPS0_ENKUlPvE_clES3 () #17 0x00000000025c8bc6 in ZZN4grpc13ThreadManager12WorkerThreadC4EPS0_ENUlPvE_4_FUNES3 () #18 0x00000000029876b1 in ZZN9grpc_core12_GLOBAL__N_120ThreadInternalsPosixC4EPKcPFvPvES4_PbRKNS_6Thread7OptionsEENKUlS4_E_clES4 () #19 0x00000000029876fb in ZZN9grpc_core12_GLOBAL__N_120ThreadInternalsPosixC4EPKcPFvPvES4_PbRKNS_6Thread7OptionsEENUlS4_E_4_FUNES4 () #20 0x00007feef6e116db in start_thread () from /root/data/utbot/utbot_distr/server-install/../lib/libpthread.so.0 #21 0x00007feef3a2061f in clone () from /root/data/utbot/utbot_distr/server-install/../lib/libc.so.6

  • Better directory structure for artifacts

    Better directory structure for artifacts

    Description Put klee files in utbot_build (right now it's in build) directory. Put Makefile in separate directory in tests

    Potential solution As a hint, look into how klee file paths are built from compile_commands.json in BuildDatabase::createClangCompileCommandsJson (see how output is set and analyze how getCCJsonFileFullPath affects setting output in CompileCommand constructor)

    Context 525359AD-27BE-4DA9-8F52-8BFAF9EF7831

  • KLEE performance regression after rebase to 2.3 [BUG]

    KLEE performance regression after rebase to 2.3 [BUG]

    Description Performance regression about 2 times on project https://github.com/UnitTestBot/UTBotCpp/tree/main/server/test/suites/syntax function sort_list

    Visual proofs (screenshots, logs) https://github.com/UnitTestBot/UTBotCpp/runs/7590354187?check_suite_focus=true#step:5:6400

  • Cannot run tests for functions with C99 features not permitted in C++ [BUG]

    Cannot run tests for functions with C99 features not permitted in C++ [BUG]

    Description If source file contains C99 feature not permitted in C++, then no generated tests can be run.

    To Reproduce Steps to reproduce the behavior:

    1. Generate tests for the following function:
    int sum_sign_9_11_static(int a[static 9][11]) {
        int sum = 0;
        for (int i = 0; i < 9; i++) {
            for (int j = 0; j < 11; j++) {
                sum += a[i][j];
            }
        }
        if (sum == 0) {
            return 0;
        } else if (sum > 0) {
            return 1;
        } else {
            return -1;
        }
    }
    
    1. Run test:
    TEST(error, sum_sign_9_11_static_test_1)
    {
        int a[2][11] = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
        sum_sign_9_11_static(a);
    }
    

    Expected behavior Generated test runs correctly.

    Actual behavior The following error occurred:

    static array size is a C99 feature, not permitted in C++
    static int sum_sign_9_11_static(int a[static 9][11]) {
    

    Moreover, if there are another correct tested functions in the source file, tests for them also cannot be run as source file cannot be compiled.

    Environment UTBotCpp 2022.7.3.

Related tags
Boiler plate template for C++ projects, with CMake, Doctest, Travis CI, Appveyor, Github Actions and coverage reports.
Boiler plate template for C++ projects, with CMake, Doctest, Travis CI, Appveyor, Github Actions and coverage reports.

Boiler plate for C++ projects This is a boiler plate for C++ projects. What you get: Sources, headers and mains separated in distinct folders Use of m

Aug 10, 2022
A command-line tool to generate Linux manual pages from C source code.

mangen A command-line tool to generate Linux manual pages from C source code. Description mangen is, as said above, a program to generate Linux manual

Nov 15, 2021
This is the massive repository for all code for the class CIS3250 Fall Semester.

========================================== Transforming Shapes Through Matrix Multiplication ========================================== Description o

Nov 25, 2021
The new Windows Terminal and the original Windows console host, all in the same place!

The new Windows Terminal and the original Windows console host, all in the same place!

Aug 18, 2022
Toybox: all-in-one Linux command line.

Toybox: all-in-one Linux command line.

Aug 9, 2022
nicegraf-shaderc is a command-line tool that transforms HLSL code into shaders for various graphics APIs.
nicegraf-shaderc is a command-line tool that transforms HLSL code into shaders for various graphics APIs.

User Manual Table of Contents Introduction Project Status Obtaining the Source Code and Building Running Defining Techniques Generated Header File Pip

Jul 28, 2022
CodeCompactor is an open source program designed for reducing the size of your code!

CodeCompacter An exciting, new and open source program for reducing the length of your code! Usage: ./CodeCompacter {ARGUMENTS} Arguments: -L {languag

Nov 28, 2021
This repository contains the source code of the project(StereoCraft) that we have developed for the Mixed Reality Hackathon organized by Microsoft using StereoKit SDK

StereoCraft - A block-building like experience built using StereoKit This repository contains the source code of the project that we have developed fo

Dec 23, 2021
Bootloader recovery and updater tool for StarFive JH17x0 SoCs.
Bootloader  recovery and updater tool for StarFive JH17x0 SoCs.

JH71xx-tools Bootloader recovery and updater tool for StarFive JH7100 SoCs.

May 1, 2022
A command line tool for numerically computing Out-of-time-ordered correlations for N=4 supersymmetric Yang-Mills theory and Beta deformed N=4 SYM.

A command line tool to compute OTOC for N=4 supersymmetric Yang–Mills theory This is a command line tool to numerically compute Out-of-time-ordered co

Oct 16, 2021
CfgManipulator is a fast and powerful tool for working with configuration files for the C++ language
CfgManipulator is a fast and powerful tool for working with configuration files for the C++ language

CfgManipulator is a fast and powerful tool for working with configuration files for the C++ language. It can read, create strings and sections, change the value of a string and much more.

Jan 28, 2022
FastReport.Cloud console tool for Linux and perhaps some other OSes

FastReport Cloud console shell This is a simple console shell to FastReport Cloud service. Prerequests GNU packages for build shell: curl-development

Feb 10, 2022
Real time crypto monitoring tool
Real time crypto monitoring tool

Real-time Crypto Currency Monitor This monitor is a command line dashboard, it uses ncurses, in combination with the Binance API where it fetches all

Aug 5, 2022
pbr2gltf2 is a command line tool for converting PBR images to a glTF 2.0 material.
pbr2gltf2 is a command line tool for converting PBR images to a glTF 2.0 material.

pbr2gltf2 is a command line tool for converting PBR images to a glTF 2.0 material. The tool is detecting depending on the filename, which PBR information is stored. It swizzles the images and does reassign the channels to a glTF 2.0 image. The tool stores the images plus a minimal, valid glTF 2.0 file containing the required material, textures and images.

Jul 31, 2022
A command-line tool to display colorful distro information.
A command-line tool to display colorful distro information.

sjfetch A command-line tool to display colorful distro information.

Apr 6, 2022
Fegeya Freud, CLI FPaper renderer, based on Totem (`less`-like tool without `--help`)
Fegeya Freud, CLI FPaper renderer, based on Totem (`less`-like tool without `--help`)

Fegeya Freud, CLI FPaper renderer, based on Totem (`less`-like tool without `--help`)

Jun 11, 2021
Simple command line tool that processes image files using the FidelityFX Super Resolution (FSR) or Contrast Adaptive Sharpening (CAS) shader systems.

Simple command line tool that processes image files using the FidelityFX Super Resolution (FSR) or Contrast Adaptive Sharpening (CAS) shader systems.

Aug 9, 2022
A command line tool with no external dependencies to print information about an X server instance.

xinfo A command line tool with no external dependencies to print information about an X server instance. Building and running To build the code in thi

Jan 13, 2022
A C++ console tool to tracker baby actions.

BabyTracker This is a C++ console tool to tracker baby actions. Currently it supports adding Sleep Sessions Breast Feed Sessions Bottle Feed Sessions

Oct 17, 2021