[Ecm-commits] r2686 - trunk

cvs commits ecm-commits at lists.gforge.inria.fr
Wed Apr 22 15:58:32 CEST 2015


Author: zimmerma
Date: 2015-04-22 15:58:32 +0200 (Wed, 22 Apr 2015)
New Revision: 2686

Modified:
   trunk/resume.c
   trunk/test.ecm
Log:
improve coverage


Modified: trunk/resume.c
===================================================================
--- trunk/resume.c	2015-04-21 11:36:23 UTC (rev 2685)
+++ trunk/resume.c	2015-04-22 13:58:32 UTC (rev 2686)
@@ -182,20 +182,14 @@
           if (strcmp (tag, "METHOD") == 0)
             {
               if (facceptstr (fd, "ECM") == 3)
+                *method = ECM_ECM;
+              else if (facceptstr (fd, "P-1") == 3)
                 {
-                  *method = ECM_ECM;
-                }
-              else if (facceptstr (fd, "P"))
-                {
                   a = facceptstr (fd, "-1");
                   if (a == 2)
-                    {
-                      *method = ECM_PM1;
-                    }
+                    *method = ECM_PM1;
                   else if (a == 0 && facceptstr (fd, "+1") == 2)
-                    {
-                      *method = ECM_PP1;
-                    }
+                    *method = ECM_PP1;
                   else 
                     goto error;
                 }

Modified: trunk/test.ecm
===================================================================
--- trunk/test.ecm	2015-04-21 11:36:23 UTC (rev 2685)
+++ trunk/test.ecm	2015-04-22 13:58:32 UTC (rev 2686)
@@ -183,10 +183,10 @@
 echo 17061648125571273329563156588435816942778260706938821014533 | $ECM -param 0 -sigma 585928442 174000; checkcode $? 14
 
 # test -save/-resume
+/bin/rm -f test.ecm.save
 echo 17061648125571273329563156588435816942778260706938821014533 | $ECM -save test.ecm.save -param 0 -sigma 585928442 174000 0
 $ECM -resume test.ecm.save 174000 85880350
 C=$?
-/bin/rm -f test.ecm.save
 checkcode $C 14
 
 # test savea
@@ -194,9 +194,69 @@
 echo 17061648125571273329563156588435816942778260706938821014533 | $ECM -savea test.ecm.save -param 0 -sigma 585928442 174000 0
 $ECM -resume test.ecm.save 174000 85880350
 C=$?
-/bin/rm -f test.ecm.save
 checkcode $C 14
 
+# test unknown method
+echo "METHOD=FOO" > test.ecm.save
+$ECM -resume test.ecm.save 174000 85880350
+C=$?
+checkcode $C 1
+
+# test invalid checksum
+echo "CHECKSUM=xxx" > test.ecm.save
+$ECM -resume test.ecm.save 174000 85880350
+C=$?
+checkcode $C 1
+
+# test comment
+echo "METHOD=P-1;X=0;N=17;B1=2;COMMENT=this is a comment;" > test.ecm.save
+$ECM -resume test.ecm.save 174000 85880350
+C=$?
+checkcode $C 1
+
+# test invalid param
+echo "PARAM=xxx" > test.ecm.save
+$ECM -resume test.ecm.save 174000 85880350
+C=$?
+checkcode $C 1
+
+# test invalid etype
+echo "ETYPE=xxx" > test.ecm.save
+$ECM -resume test.ecm.save 174000 85880350
+C=$?
+checkcode $C 1
+
+# test invalid B1
+echo "B1=xxx" > test.ecm.save
+$ECM -resume test.ecm.save 174000 85880350
+C=$?
+checkcode $C 1
+
+# test unknown tag
+echo "FOO=xxx" > test.ecm.save
+$ECM -resume test.ecm.save 174000 85880350
+C=$?
+checkcode $C 1
+
+# test semicolon after tags
+echo "METHOD=P-1;X=0;N=17;B1=2" > test.ecm.save
+$ECM -resume test.ecm.save 174000 85880350
+C=$?
+checkcode $C 1
+
+# test QX tag without sigma
+echo "METHOD=ECM;QX=0;N=17;B1=2;" > test.ecm.save
+$ECM -resume test.ecm.save 174000 85880350
+C=$?
+checkcode $C 1
+
+# test missing fields
+echo "METHOD=ECM;QX=0;N=17;" > test.ecm.save
+$ECM -resume test.ecm.save 174000 85880350
+C=$?
+checkcode $C 1
+
+/bin/rm -f test.ecm.save
 echo 17061648125571273329563156588435816942778260706938821014533 | $ECM -save test.ecm.save -A 22/7 -x0 1/3 -y0 2/7 1e3
 $ECM -resume test.ecm.save 1e3
 C=$?



More information about the Ecm-commits mailing list