@@ -19,17 +19,38 @@ outfile=$DIR/tested-functions-list.md
19
19
20
20
echo " ## List of tested functions" > $outfile
21
21
22
+ exampleFiles=$( find ./examples -type f \( -iname ' *.c' -o -iname ' *.cpp' -o -iname ' *.h' -o -iname ' *.hpp' -o -iname ' *.asm' \) )
23
+
22
24
for f in $files
23
25
do
24
26
echo -e " \n### $f " >> $outfile
25
- echo -e " | Function | Tested ? |" >> $outfile
26
- echo -e " | -------- | ----------- |" >> $outfile
27
- filectags=$( ctags -u --fields=n --c-kinds=p --output-format=json $f | sed -e ' s/.*"name": "\(.*\)", "path.*/\1/g' )
28
- for c in $filectags
27
+ echo -e " | Function | Tested? | Search link |" >> $outfile
28
+ echo -e " | -------- | ------- | ----------- |" >> $outfile
29
+
30
+ # This will produce a list of funcName:funcLine, which we'll parse i nthe for loop below.
31
+ filefuncts=$( ctags -u --fields=n --c-kinds=p --output-format=json $f | sed -e ' s/.*"name": "\(.*\)", "path.*"line": \(.*\)}/\1:\2/g' )
32
+ totalFuncs=0
33
+ totalTested=0
34
+ for funcAndLine in $filefuncts
29
35
do
30
- grep -Rq --include \* .h --include \* .cpp --include \* .h --include \* .c " $c " ./examples && found=" <span style='color:green'>✓</span>" || found=" <span style='color:red'>✗</span>"
31
- echo " | \` $c \` | $found |" >> $outfile
36
+ (( totalFuncs++ ))
37
+ func=${funcAndLine%:* }
38
+ line=${funcAndLine##*: }
39
+ count=$( grep -l " $func " ${exampleFiles} | wc -l | awk ' {print $1}' )
40
+ if [[ " $count " == " 0" ]]
41
+ then
42
+ foundStr=" ✗"
43
+ searchLink=" "
44
+ else
45
+ (( totalTested++ ))
46
+ foundStr=" YES (x$count )"
47
+ searchLink=" [occurrences](https://github.com/search?q=${func} +repo%3ACE-Programming%2Ftoolchain+path%3Aexamples&type=Code)"
48
+ fi
49
+ echo -e " | [\` ${func} \` ](/${f} #L${line} ) | $foundStr | $searchLink " >> $outfile
32
50
done
51
+ echo -e " \n**Total: ${totalTested} /${totalFuncs} tested.**" >> $outfile
33
52
done
34
53
54
+ echo -e " \n\n---\n*Generated by [gen_list.sh](/tools/funcs_tested/gen_list.sh)*" >> $outfile
55
+
35
56
cat $outfile
0 commit comments