[LON-CAPA-cvs] cvs: loncom /homework/caparesponse caparesponse.c

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 01 Dec 2005 22:34:10 -0000


albertel		Thu Dec  1 17:34:10 2005 EDT

  Modified files:              
    /loncom/homework/caparesponse	caparesponse.c 
  Log:
  - BUG#4475
  <formularesponse answer="35*10^3">
   with no smaples defiend now works correctly
  
  
Index: loncom/homework/caparesponse/caparesponse.c
diff -u loncom/homework/caparesponse/caparesponse.c:1.18 loncom/homework/caparesponse/caparesponse.c:1.19
--- loncom/homework/caparesponse/caparesponse.c:1.18	Mon Nov  7 18:37:39 2005
+++ loncom/homework/caparesponse/caparesponse.c	Thu Dec  1 17:34:10 2005
@@ -1,6 +1,6 @@
 /* The LearningOnline Network with CAPA 
  * CAPA wrapper code
- * $Id: caparesponse.c,v 1.18 2005/11/07 23:37:39 albertel Exp $
+ * $Id: caparesponse.c,v 1.19 2005/12/01 22:34:10 albertel Exp $
  *
  * Copyright Michigan State University Board of Trustees
  *
@@ -97,9 +97,9 @@
   if (type == ANSWER_IS_FORMULA) {
     p.id_list=id_list;
     p.pts_list=parse_pts_list(pts_list);
-    if ( p.id_list == NULL || p.pts_list == NULL) {
-      return BAD_FORMULA;
-    }
+//  if ( p.id_list == NULL || p.pts_list == NULL) {
+//    return BAD_FORMULA;
+//  }
   }
   p.ans_type   = type;
   p.answer     = correct;
@@ -163,7 +163,7 @@
     }
   }
   if( !all_alphabet ) {
-    tmp_unit_str[0]=NULL;
+    tmp_unit_str[0] = 0;
     outcome = split_num_unit(answer,&n_part,input,tmp_unit_str);
     if( outcome > 1 ) { /* with both num and unit parts or only unit part */
       if( ans_unit != NULL ) {
@@ -188,3 +188,19 @@
   } 
   return result;
 }
+
+/* Testing harnass
+int main(void) {
+  int result=0;
+  char *reterror=NULL;
+  result= caparesponse_capa_check_answer("10^3","1000",
+					 ANSWER_IS_FORMULA,
+					 TOL_ABSOLUTE,1E-3,
+					 3,5,NULL,NULL,
+					 CALC_UNFORMATED,
+					 "","4",
+					 "rndseed",
+					 &reterror);
+  fprintf(stderr,"result %d\nreterror: %s\n",result,reterror);
+}
+*/