more configurations to mutabelle
authorbulwahn
Mon, 23 Jan 2012 11:59:00 +0100
changeset 46310 8af202923906
parent 46309 693d8d7bc3cd
child 46311 56fae81902ce
more configurations to mutabelle
src/HOL/Mutabelle/lib/Tools/mutabelle
src/HOL/Mutabelle/mutabelle_extra.ML
--- a/src/HOL/Mutabelle/lib/Tools/mutabelle	Fri Jan 20 09:28:54 2012 +0100
+++ b/src/HOL/Mutabelle/lib/Tools/mutabelle	Mon Jan 23 11:59:00 2012 +0100
@@ -16,6 +16,7 @@
   echo "    -L LOGIC     parent logic to use (default $MUTABELLE_LOGIC)"
   echo "    -T THEORY    parent theory to use (default $MUTABELLE_IMPORT_THEORY)"
   echo "    -O DIR       output directory for test data (default $MUTABELLE_OUTPUT_PATH)"
+  echo "    -N NUMBER    number of lemmas to choose randomly, if not given all lemmas are chosen"
   echo
   echo "  THEORY is the name of the theory of which all theorems should be"
   echo "  mutated and tested."
@@ -30,7 +31,7 @@
 
 MUTABELLE_IMPORTS=""
 
-while getopts "L:T:O:" OPT
+while getopts "L:T:O:N:" OPT
 do
   case "$OPT" in
     L)
@@ -42,6 +43,9 @@
     O)      
       MUTABELLE_OUTPUT_PATH="$OPTARG"
       ;;
+    N)
+      NUMBER_OF_LEMMAS="$OPTARG"
+      ;;
     \?)
       usage
       ;;
@@ -66,6 +70,9 @@
 
 export MUTABELLE_OUTPUT_PATH
 
+if [ "$NUMBER_OF_LEMMAS" != "" ]; then
+  MUTABELLE_FILTER="|> MutabelleExtra.take_random $NUMBER_OF_LEMMAS"
+fi
 
 ## main
 
@@ -104,7 +111,7 @@
 ML {*
 fun mutation_testing_of thy =
   (MutabelleExtra.random_seed := 1.0;
-  MutabelleExtra.thms_of false thy
+  MutabelleExtra.thms_of false thy $MUTABELLE_FILTER 
   |> (fn thms => MutabelleExtra.mutate_theorems_and_write_report
          @{theory} mtds thms (\"$MUTABELLE_OUTPUT_PATH/log\")))
 *}
--- a/src/HOL/Mutabelle/mutabelle_extra.ML	Fri Jan 20 09:28:54 2012 +0100
+++ b/src/HOL/Mutabelle/mutabelle_extra.ML	Mon Jan 23 11:59:00 2012 +0100
@@ -51,11 +51,11 @@
 
 
 (* mutation options *)
-(*val max_mutants = 4
-val num_mutations = 1*)
+val max_mutants = 4
+val num_mutations = 1
 (* soundness check: *)
-val max_mutants =  10
-val num_mutations = 1
+(*val max_mutants =  10
+val num_mutations = 1*)
 
 (* quickcheck options *)
 (*val quickcheck_generator = "SML"*)