Skip to content

Commit d4e5858

Browse files
committed
added tests for C library extraction.
1 parent c08e194 commit d4e5858

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

test/fixtures/C.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include<assert.h>
2+
#include "complex.h"
3+
#include <ctype.h>
4+
#include "stdio.h"
5+
#include<float.h>
6+
#include"string.h"
7+
#include "hey/sup/iomanip.h"
8+
#include<Hey/ssup/math.h>
9+
#include"hello/how/stdlib.h"
10+
#include <great/wchar.h>
11+
#include"stdbool.h"
12+
#include<stdint.h>
13+
#include "hello12"
14+
#include<WsSup34>
15+
#include <heyYo3-lol>

test/test_C.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import os
2+
from language.C import extract_libraries
3+
4+
def test_extract_libraries():
5+
dir_path = os.path.dirname(os.path.realpath(__file__))
6+
files = ['fixtures/C.c']
7+
fq_files = [os.path.join(dir_path, f) for f in files]
8+
libs = extract_libraries(fq_files)
9+
assert len(libs) == 1
10+
11+
assert libs['C'] == [
12+
"assert.h",
13+
"complex.h",
14+
"ctype.h",
15+
"stdio.h",
16+
"float.h",
17+
"string.h",
18+
"hey/sup/iomanip.h",
19+
"Hey/ssup/math.h",
20+
"hello/how/stdlib.h",
21+
"great/wchar.h",
22+
"stdbool.h",
23+
"stdint.h",
24+
"hello12",
25+
"WsSup34",
26+
"heyYo3-lol"
27+
]

0 commit comments

Comments
 (0)