# !/bin/sh 
#
# Check CNF (long check - all methods involved):
#   Load BDDs
#   Store corresponding CNF in different format:
#     NodeByNode method -> file 4.node1.tmp
#     MaxtermByMaxterm -> file 4.max1.tmp
#     Best with different options:
#       MaxEdge=-1 MaxPath= 0 -> similar to NodeByNode -> file 4.node2.tmp
#       MaxEdge= 0 MaxPath=-1 -> similar to NodeByNode -> file 4.node3.tmp
#       MaxEdge=-1 MaxPath=-1 -> = MaxtermByMaxterm -> file 4.max2.tmp
#       MaxEdge= 1 MaxPath=-1 -> = Original Best -> file 4.best1.tmp
#       MaxEdge= 1 MaxPath= 2 -> = Original Best, With Path Shorter than 3 
#                                  file 4.best2.tmp
#   Read CNF
#   Store corresponding BDD
#   Compare original and final BDDs
#
rm -f *.tmp*
echo "---------------------------------------------------------------------------"     
echo "--------------------- TESTING Load BDD and Store CNF ----------------------"
echo "---------------------------------------------------------------------------"     
./../testdddmp << END1
mi
150
hlc
4.cnf.bis
bl
4.bdd
0
cs
4.node1.tmp
0
N
100
cs
4.max1.tmp
0
M
100
cs
4.node2.tmp
0
B
-1
0
100
cs
4.node3.tmp
0
B
0
-1
100
cs
4.max2.tmp
0
B
-1
-1
100
cs
4.best1.tmp
0
B
1
-1
100
cs
4.best2.tmp
0
B
1
2
100
mq
quit
END1
echo "---------------------------------------------------------------------------"     
echo "--------------------- TESTING Load CNF and Store BDD ----------------------"
echo "---------------------------------------------------------------------------"     
./../testdddmp << END2
mi
150
hlc
4.node2.tmp
cl
4.node2.tmp
0
hw
bs
4.node2.bdd.tmp
0
mq
quit
END2
./../testdddmp << END3
mi
150
hlc
4.node3.tmp
cl
4.node3.tmp
0
hw
bs
4.node3.bdd.tmp
0
mq
quit
END3
./../testdddmp << END4
mi
150
hlc
4.best1.tmp
cl
4.best1.tmp
0
hw
bs
4.best1.bdd.tmp
0
mq
quit
END4
./../testdddmp << END5
mi
150
hlc
4.best2.tmp
cl
4.best2.tmp
0
hw
bs
4.best2.bdd.tmp
0
mq
quit
END5
echo "----------------------------- ... RESULTS ... -----------------------------"
diff --brief 4.max1 4.max1.tmp
diff --brief 4.max2 4.max2.tmp
diff --brief 4.bdd.bis1 4.node2.bdd.tmp
diff --brief 4.bdd.bis2 4.node3.bdd.tmp
diff --brief 4.bdd.bis3 4.best1.bdd.tmp
diff --brief 4.bdd.bis4 4.best2.bdd.tmp
echo "-------------------------------- ... END ----------------------------------"
rm -f *.tmp*
