amnakhan786 0 Newbie Poster

description of the program:
1. first i have to input a folder A by giving full filepath. this folder contains a benchmark program tcas.c, a text file universe.txt
which contains 1500 lines, each line is a test case giving 12 arguments to the benchmark program, which are used to test the conditions,
statements, functions and definition- use pairs e.g.test 0:
1258 1 0 897 174 7253 1 629 500 0 0 1.
the folder A also contains a coverage folder which has 1500 folders each describing the coverage for each test as follows:
folder A/coverage/test0/sss.txt. sss are actually four text files whose description is as follows:
i) the first text file contains all the conditions executed by the test case 0(cond.txt).e.g.
tcas.c:73:0x8048470:0
tcas.c:75:0x8048480:0
and so on...
ii) the second text file contains all the statements executed by the test case 0(stmt.txt).e.g.
tcas.c:49
tcas.c:50
tcas.c:51
.
.
.
iii) the third text file contains all the functions executed by the test case 0(func.txt).e.g.
Own_Below_Threat
Non_Crossing_Biased_Descend
initialize
main
.
.
.
.
iv) the fourth text file contains all the definition use pairs executed by the test case 0(defu.txt).e.g.
(tcas.c:49, tcas.c:54)// here a variable defined at 49 and used at 54.
(tcas.c:51, tcas.c:58)
(tcas.c:54, tcas.c:158)
.
.
.

2. in this way coverage has 1500 test cases ranging from test0.....test1500, and each testn folder contains above four text files.
Now the requirement of the code:
i have to write a code in c language which opens the folder A and picks a testn e.g. test0. for test zero it picks stmt.txt.
i.e. i am preparing a test suite for Statement coverage for program tcas.
then read all test cases and its covegare information from coverage/test$$/STMT.txt
Now each test case is not covering all the lines.So i have to pick few test cases such that union of that gives entire coverage. Now that is my 1 test suite out of 4.
i will proceed with the others in the same manner.
i want to ask that how can i write a c- language code to read statement text file in every test case and compare all 1500 statement text files such that union of a few cover all
the statements in the benchmark program tcas.c.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.