Skip to content

Generated two tests with the same input and different output [BUG] #313

Open
@operasfantom

Description

@operasfantom

Description
Suspicious tests are generated for simple C++ code.

To Reproduce
Steps to reproduce the behavior:

  1. Open UTBot online
  2. Choose C++
  3. Paste code
#include <cmath>
#include <cstring>
#include <vector>

using namespace std;

int foo(std::vector<int> v) 
{
  // TODO: write your code here
  return 0;
}
  1. Generate and run tests

Expected behavior
One regression test is supposed to be generated.

Actual behavior
One regression and one error test are generated.

Visual proofs (screenshots, logs)

/*
 * This file is automatically generated by UnitTestBot. For further information seehttps://unittestbot.org
 */

#include "snippet_dot_cpp_test.h"

#include "gtest/gtest.h"

#include "access_private.hpp"


namespace UTBot {
static const float utbot_abs_error = 1e-6;


#pragma region regression
TEST(regression, foo_test_1)
{
    int actual = foo({
});
    EXPECT_EQ(0, actual);
}

#pragma endregion
#pragma region error
TEST(error, foo_test_2)
{
    foo({
});
}

#pragma endregion
}

Environment
UTBot Online.

Additional context
No context.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcpp-syntaxRelated to generation tests for C++wrong generationInadequate or empty test suite generated

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions