-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchets.sh
executable file
·83 lines (81 loc) · 2.19 KB
/
chets.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
echo "Checking cpp files"
for i in $1/*.cpp;
do
for j in $2/*.cpp;
do
FILE1="${i##*/}"
FILE2="${j##*/}"
if [ "$FILE1" = "$FILE2" ];
then echo ${i} " and " ${j}; UNI=$(sdiff -B -b -s -i $i $j | wc -l); ILINES=$(cat $i | wc -l) && JLINES=$(cat $j | wc -l);
((JLINES+=1));
((ILINES+=1));
#echo "UNI: $UNI";
#echo "ILINES: $ILINES";
#echo "JLINES: $JLINES";
TOT=$[ILINES + JLINES];
#echo "TOT: $TOT";
SUB=$[TOT - UNI];
#echo "SUB: $SUB";
DIV=$[SUB / 2];
#echo "DIV: $DIV";
PERC=$(bc <<< "scale=2;$DIV/$JLINES");
#echo "PERC: $PERC";
FINAL=$(bc <<< "scale=1;$PERC*100");
echo "${FINAL%.*}% the same" && echo;
fi
done;
done
echo "Checking h files"
for i in $1/*.h;
do
for j in $2/*.h;
do
FILE1="${i##*/}"
FILE2="${j##*/}"
if [ "$FILE1" = "$FILE2" ];
then echo ${i} " and " ${j}; UNI=$(sdiff -B -b -s -i $i $j | wc -l); ILINES=$(cat $i | wc -l) && JLINES=$(cat $j | wc -l);
((JLINES+=1));
((ILINES+=1));
#echo "UNI: $UNI";
#echo "ILINES: $ILINES";
#echo "JLINES: $JLINES";
TOT=$[ILINES + JLINES];
#echo "TOT: $TOT";
SUB=$[TOT - UNI];
#echo "SUB: $SUB";
DIV=$[SUB / 2];
#echo "DIV: $DIV";
PERC=$(bc <<< "scale=2;$DIV/$JLINES");
#echo "PERC: $PERC";
FINAL=$(bc <<< "scale=1;$PERC*100");
echo "${FINAL%.*}% the same" && echo;
fi
done;
done
#for i in $1/*;
#do
# for j in $2/*;
# do
# FILE1="${i##*/}"
# FILE2="${j##*/}"
# if [ "$FILE1" = "$FILE2" ];
# then echo ${i} " and " ${j}; UNI=$(sdiff -B -b -s -i $i $j | wc -l); ILINES=$(cat $i | wc -l) && JLINES=$(cat $j | wc -l);
# ((JLINES+=1));
# ((ILINES+=1));
# #echo "UNI: $UNI";
# #echo "ILINES: $ILINES";
# #echo "JLINES: $JLINES";
# TOT=$[ILINES + JLINES];
# #echo "TOT: $TOT";
# SUB=$[TOT - UNI];
# #echo "SUB: $SUB";
# DIV=$[SUB / 2];
# #echo "DIV: $DIV";
# PERC=$(bc <<< "scale=2;$DIV/$JLINES");
# #echo "PERC: $PERC";
# FINAL=$(bc <<< "scale=1;$PERC*100");
# echo "${FINAL%.*}% the same" && echo;
# fi
# done;
#done