浏览代码

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 年之前
父节点
当前提交
67a869807b
共有 1 个文件被更改,包括 4 次插入3 次删除
  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)
 {
   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);
   crt = PEM_read_X509(fp, NULL, 0, NULL);
@@ -170,17 +170,18 @@ void test_wiener(void)
     exit(EXIT_FAILURE);
   }
 
-  WienerQuestion.setup();
   assert(WienerQuestion.test(crt));
   assert(WienerQuestion.ask(crt));
-  WienerQuestion.teardown();
 }
 
 int main(int argc, char ** argv)
 {
+  WienerQuestion.setup();
+
   test_cf();
   test_BN_sqrtmod();
   test_wiener();
 
+  WienerQuestion.teardown();
   return 0;
 }