Skip to content

Instantly share code, notes, and snippets.

@PhiBabin
Created February 19, 2014 21:29
Show Gist options
  • Select an option

  • Save PhiBabin/9102026 to your computer and use it in GitHub Desktop.

Select an option

Save PhiBabin/9102026 to your computer and use it in GitHub Desktop.
Date d(29,03,1994);
Date b(30,03,1992);
Date e(28,03,1994);
Date dNow();
cout<< "29/03/94" << " " << d << endl;
cout<< "Jour test:" << ((d.reqJour() == 29)?"[OK]":"[FAIL]") << endl;
cout<< "Mois test:" << ((d.reqMois() == 3)?"[OK]":"[FAIL]") << endl;
cout<< "Annee test:" << ((d.reqAnnee() == 1994)?"[OK]":"[FAIL]") << endl;
cout<< "Jour année:" << (d.reqJourAnnee() == 88 ?"[OK]":"[FAIL]") << endl;
cout<< "Jour semaine test: Mardi = > " << (d.reqDateFormatee() /*== 728 ?"[OK]":"[FAIL]"*/) << endl;
cout<< "Bissextile A test:" << (!d.estBissextile(d.reqAnnee())?"[OK]":"[FAIL]") << endl;
cout<< "Bissextile B test:" << (b.estBissextile(b.reqAnnee())?"[OK]":"[FAIL]") << endl;
cout<< "Comparator test:" << (e<b?"[OK]":"[FAIL]") << endl;
cout<< "Majorité test:" << (d.majorite()?"[OK]":"[FAIL]") << endl;
cout<< "Subtraction A test:" << (d - b == 728 ?"[OK]":"[FAIL]") << endl;
cout<< "Subtraction B test:" << (b - d == -728 ?"[OK]":"[FAIL]") << endl;
d.ajouteNbJour(3);
cout<<"[+3]"<< "1/04/1994" << " " << d << endl;
d.ajouteNbJour(30);
cout<<"[+30]"<< "1/05/1994" << " " << d << endl;
d.ajouteNbJour(365);
cout<<"[+365]"<< "1/05/1995" << " " << d << endl;
d.ajouteNbJour(1095);
cout<<"[+1095]"<< "30/04/1998" << " " << d << endl;
d.ajouteNbJour(-1095);
cout<<"[-1095]"<< "30/04/1999" << " " << d << endl;
//cout<< "now :" << " " << dNow.reqJour() << endl;
cout << "Validation du nom Jean-Marie Marc 666 André:" << (validerFormatNom("Jean-Marie Marc 666 André")?"[OK]":"[FAIL]") << endl;
//cout << "YES!!!!" << d << endl;
// TEST de la classe Personne
string prenom = "Jean", nom = "Dumont", telephone = "(581) 983-6235";
Date dateNaissance(02, 12, 1987), dateNaissanceAlfred(10, 05, 1989);
Personne Robert(nom, prenom, dateNaissance, telephone);
Personne Alfred("Alfred", "Bichon", dateNaissanceAlfred, "(418) 987-5235");
// Comparateur classe
cout << "Comparaison RvsA: " << ((Robert == Alfred)?"[OK]":"[FAIL]") << endl;
cout << "Comparaison RvsR: " << ((Robert == Robert)?"[OK]":"[FAIL]") << endl;
// Afficheur
cout << Robert.reqPersonneFormate() << endl;
cout << Alfred.reqPersonneFormate() << endl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment