Browse Source

Moving setup() and teardown() for questions to the global main.

Moving constructor and destructor for questions in main, this way there shall not
be overhead between two tests just for setting up the global
variables. Moreover, it tests that the question stays consistent on multiple
calls of ask().
Michele Orrù 11 years ago
parent
commit
67a869807b
1 changed files with 4 additions and 3 deletions
  1. 4 3
      src/questions/tests/test_wiener.c

+ 4 - 3
src/questions/tests/test_wiener.c

@@ -162,7 +162,7 @@ void test_BN_sqrtmod(void)
 void test_wiener(void)
 void test_wiener(void)
 {
 {
   X509 *crt;
   X509 *crt;
-  FILE *fp = fopen("questions/test/wiener_test.crt", "r");
+  FILE *fp = fopen("questions/tests/wiener_test.crt", "r");
 
 
   if (!fp) exit(EXIT_FAILURE);
   if (!fp) exit(EXIT_FAILURE);
   crt = PEM_read_X509(fp, NULL, 0, NULL);
   crt = PEM_read_X509(fp, NULL, 0, NULL);
@@ -170,17 +170,18 @@ void test_wiener(void)
     exit(EXIT_FAILURE);
     exit(EXIT_FAILURE);
   }
   }
 
 
-  WienerQuestion.setup();
   assert(WienerQuestion.test(crt));
   assert(WienerQuestion.test(crt));
   assert(WienerQuestion.ask(crt));
   assert(WienerQuestion.ask(crt));
-  WienerQuestion.teardown();
 }
 }
 
 
 int main(int argc, char ** argv)
 int main(int argc, char ** argv)
 {
 {
+  WienerQuestion.setup();
+
   test_cf();
   test_cf();
   test_BN_sqrtmod();
   test_BN_sqrtmod();
   test_wiener();
   test_wiener();
 
 
+  WienerQuestion.teardown();
   return 0;
   return 0;
 }
 }