Skip to content

Commit 3cdb310

Browse files
Dmitry IvanovDmitry Ivanov
authored andcommitted
Content: server, vscode plugin, integration tests
1 parent 5c95167 commit 3cdb310

File tree

744 files changed

+59677
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

744 files changed

+59677
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.vscode/
2+
build/
3+
tests/
4+
utbot-tests/
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
project(c-example)
3+
4+
set(CMAKE_C_STANDARD 11)
5+
set(CMAKE_CXX_STANDARD 17)
6+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
7+
set(CMAKE_C_STANDARD_REQUIRED ON)
8+
9+
# required!
10+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
11+
set(CMAKE_EXPORT_LINK_COMMANDS ON)
12+
13+
add_subdirectory(lib)
14+
add_subdirectory(src)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
add_library(lib)
2+
target_include_directories(lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
3+
file(GLOB_RECURSE ALL_SOURCES "*.c" "*.h")
4+
target_sources(lib PRIVATE ${ALL_SOURCES})
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
* Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved.
3+
*/
4+
5+
char *passthrough(__attribute__((align_value(0x8000))) char *x) {
6+
return x;
7+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved.
3+
*/
4+
5+
#include "assertion_failures.h"
6+
7+
int buggy_function1(int a, int b) {
8+
if (a > b) {
9+
assert(a != 42);
10+
return a;
11+
}
12+
else {
13+
return b;
14+
}
15+
}
16+
17+
int buggy_function2(int a) {
18+
assert(a == 7);
19+
assert(a < 7);
20+
return a;
21+
}
22+
23+
int buggy_function3(int a, int b) {
24+
assert(a < 1);
25+
assert(a < 10); // Can't generate test that fails assertion since if a >= 10 then the first assertion fails
26+
return a;
27+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved.
3+
*/
4+
5+
#ifndef SIMPLE_TEST_PROJECT_SRC_ASSERT_FAIL_H
6+
#define SIMPLE_TEST_PROJECT_SRC_ASSERT_FAIL_H
7+
8+
#include "assert.h"
9+
10+
int buggy_function1(int a, int b);
11+
int buggy_function2(int a);
12+
int buggy_function3(int a, int b);
13+
14+
#endif //UNITTESTBOT_SRC_ASSERT_FAIL_H
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved.
3+
*/
4+
5+
#include "basic_functions.h"
6+
7+
int max_(int a, int b) {
8+
if (a > b) {
9+
return a;
10+
} else {
11+
return b;
12+
}
13+
}
14+
15+
int min(int a, int b) {
16+
if (a < b) {
17+
return a;
18+
} else {
19+
return b;
20+
}
21+
}
22+
23+
int sqr_positive(int a) {
24+
if (a < 0) {
25+
return -1;
26+
} else {
27+
return a * a;
28+
}
29+
}
30+
31+
int simple_loop(unsigned int n) {
32+
int i = 0;
33+
while (i < n) {
34+
i = i + 1;
35+
if (n % i == 37)
36+
return 1;
37+
else if (i == 50)
38+
return 2;
39+
}
40+
return 0;
41+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved.
3+
*/
4+
5+
#ifndef SIMPLE_TEST_PROJECT_BASIC_FUNCTIONS_H
6+
#define SIMPLE_TEST_PROJECT_BASIC_FUNCTIONS_H
7+
8+
int max_(int a, int b);
9+
int min(int a, int b);
10+
int sqr_positive(int a);
11+
int simple_loop(unsigned int n);
12+
13+
#endif //SIMPLE_TEST_PROJECT_BASIC_FUNCTIONS_H
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved.
3+
*/
4+
5+
#include "bits.h"
6+
7+
UINT32 NSE_BITS_CLZ64(UINT64 uiiData)
8+
{
9+
UINT64 uiiMask;
10+
UINT64 i;
11+
UINT32 zeroCnt;
12+
13+
zeroCnt = 0;
14+
uiiMask = 0x8000000000000000U;
15+
for (i = 0; i < 64; i++) {
16+
if ((uiiData & uiiMask) == 0) {
17+
zeroCnt++;
18+
uiiMask >>= 1;
19+
continue;
20+
}
21+
break;
22+
}
23+
24+
return zeroCnt;
25+
}
26+
27+
UINT32 foo1(const FOO_ATTRIBUTE *attrib, UINT32 num, UINT32 id, UINT32 *offset, UINT32 *len)
28+
{
29+
UINT32 i;
30+
31+
for (i = 0; i < num; i++) {
32+
if (id == attrib[i].id) {
33+
*offset = attrib[i].offset;
34+
*len = attrib[i].len;
35+
return VOS_OK;
36+
}
37+
}
38+
39+
return VOS_ERR;
40+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved.
3+
*/
4+
5+
#ifndef UINT64
6+
#define UINT64 unsigned long long
7+
#endif
8+
9+
#ifndef UINT32
10+
#define UINT32 unsigned int
11+
#endif
12+
13+
#define VOS_ERR 1
14+
#define VOS_OK 0
15+
16+
typedef struct tagFOO_ATTRIBUTE {
17+
UINT32 offset;
18+
UINT32 len;
19+
UINT32 id;
20+
} FOO_ATTRIBUTE;
21+
22+
UINT32 NSE_BITS_CLZ64(UINT64 uiiData);
23+
24+
UINT32 foo1(const FOO_ATTRIBUTE *attrib, UINT32 num, UINT32 id, UINT32 *offset, UINT32 *len);

0 commit comments

Comments
 (0)