Olivier Marty 8 роки тому
батько
коміт
78bb5806fc
3 змінених файлів з 18 додано та 2 видалено
  1. 1 1
      code/Dates.cpp
  2. 16 0
      code/Dates_test.cpp
  3. 1 1
      main.tex

+ 1 - 1
code/Dates.cc → code/Dates.cpp

@@ -29,7 +29,7 @@ void intToDate (int jd, int &m, int &d, int &y){
 string intToDay (int jd){
   return dayOfWeek[jd % 7];
 }
-int main (int argc, char **argv){
+void test() {
   int jd = dateToInt (3, 24, 2004);
   int m, d, y;
   intToDate (jd, m, d, y);

+ 16 - 0
code/Dates_test.cpp

@@ -0,0 +1,16 @@
+#include <bits/stdc++.h>
+using namespace std;
+
+#include "Dates.cpp"
+
+int main (int argc, char **argv){
+  int jd = dateToInt (3, 24, 2004);
+  int m, d, y;
+  intToDate (jd, m, d, y);
+  string day = intToDay (jd);
+  assert(jd == 2453089);
+  assert(m == 3);
+  assert(d == 24);
+  assert(y == 2004);
+  assert(day == "Wed");
+}

+ 1 - 1
main.tex

@@ -174,7 +174,7 @@ Temps de cuisson : $O(n)$
 {\scriptsize\lstinputlisting{code/Dichotomie.cpp}} % regarder
 
 \subsection{Dates}
-{\scriptsize\lstinputlisting{code/Dates.cc}}
+{\scriptsize\lstinputlisting{code/Dates.cpp}}
 
 \subsection{Prime numbers}
 {\scriptsize\lstinputlisting{code/Primes.cc}}