Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6d0da5f

Browse files
committed
fix CFLAGS in Makefile, add more tests in test_irange_list_union()
1 parentb4712b0 commit6d0da5f

File tree

3 files changed

+72
-8
lines changed

3 files changed

+72
-8
lines changed

‎tests/cmocka/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ TOP_SRC_DIR = ../../src
33

44
CC = gcc
55
CFLAGS = -I$(TOP_SRC_DIR) -I$(shell$(PG_CONFIG) --includedir-server)
6+
CFLAGS +=$(shell$(PG_CONFIG) --cflags_sl)
7+
CFLAGS +=$(shell$(PG_CONFIG) --cflags)
68
LDFLAGS = -lcmocka
79
TEST_BIN = rangeset_tests
810

‎tests/cmocka/rangeset_tests

161 KB
Binary file not shown.

‎tests/cmocka/rangeset_tests.c

Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,26 @@
99
#include"debug_print.c"
1010

1111

12-
/* declarations of tests */
13-
staticvoidtest_1(void**state);
12+
/*
13+
* -----------------------
14+
* Declarations of tests
15+
* -----------------------
16+
*/
17+
18+
staticvoidtest_irange_list_union(void**state);
1419

1520

1621
/* Entrypoint */
1722
int
1823
main(void)
1924
{
25+
/* Array of test functions */
2026
conststructCMUnitTesttests[]=
2127
{
22-
cmocka_unit_test(test_1),
28+
cmocka_unit_test(test_irange_list_union),
2329
};
2430

31+
/* Run series of tests */
2532
returncmocka_run_group_tests(tests,NULL,NULL);
2633
}
2734

@@ -32,17 +39,72 @@ main(void)
3239
*/
3340

3441
staticvoid
35-
test_1(void**state)
42+
test_irange_list_union(void**state)
3643
{
37-
IndexRangea=make_irange(0,100, true),
38-
b=make_irange(20,50, false);
39-
44+
IndexRangea,b;
4045
List*union_result;
4146

47+
48+
/* Subtest #0 */
49+
a=make_irange(0,100, true);
50+
b=make_irange(0,100, true);
51+
union_result=irange_list_union(list_make1_irange(a),
52+
list_make1_irange(b));
53+
54+
assert_string_equal(rangeset_print(union_result),
55+
"[0-100]L");
56+
57+
/* Subtest #1 */
58+
a=make_irange(0,100, true);
59+
b=make_irange(0,100, false);
60+
union_result=irange_list_union(list_make1_irange(a),
61+
list_make1_irange(b));
62+
63+
assert_string_equal(rangeset_print(union_result),
64+
"[0-100]C");
65+
66+
/* Subtest #2 */
67+
a=make_irange(0,100, true);
68+
b=make_irange(0,50, false);
69+
union_result=irange_list_union(list_make1_irange(a),
70+
list_make1_irange(b));
71+
72+
assert_string_equal(rangeset_print(union_result),
73+
"[0-50]C, [51-100]L");
74+
75+
/* Subtest #3 */
76+
a=make_irange(0,100, true);
77+
b=make_irange(50,100, false);
78+
union_result=irange_list_union(list_make1_irange(a),
79+
list_make1_irange(b));
80+
81+
assert_string_equal(rangeset_print(union_result),
82+
"[0-49]L, [50-100]C");
83+
84+
/* Subtest #4 */
85+
a=make_irange(0,100, true);
86+
b=make_irange(50,99, false);
87+
union_result=irange_list_union(list_make1_irange(a),
88+
list_make1_irange(b));
89+
90+
assert_string_equal(rangeset_print(union_result),
91+
"[0-49]L, [50-99]C, 100L");
92+
93+
/* Subtest #5 */
94+
a=make_irange(0,100, true);
95+
b=make_irange(1,100, false);
96+
union_result=irange_list_union(list_make1_irange(a),
97+
list_make1_irange(b));
98+
99+
assert_string_equal(rangeset_print(union_result),
100+
"0L, [1-100]C");
101+
102+
/* Subtest #6 */
103+
a=make_irange(0,100, true);
104+
b=make_irange(20,50, false);
42105
union_result=irange_list_union(list_make1_irange(a),
43106
list_make1_irange(b));
44107

45108
assert_string_equal(rangeset_print(union_result),
46109
"[0-19]L, [20-50]C, [51-100]L");
47110
}
48-

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp