Salut
Je m'attaque aux tests unitaires de c++ et j'ai un ptit soucis
tout d abord ma classe :
Code :
- /*
-
- * Classe testfichier
-
- *
-
- */
- #ifndef TESTFICHIER
- #define TESTFICHIER
- #include <cppunit/TestFixture.h>
- #include <cppunit/extensions/HelperMacros.h>
- #include "fichier.h"
- #include <iostream>
- namespace sys{
- class TermTest : public CppUnit::TestFixture{
- CPPUNIT_TEST_SUITE(TermTest);
- CPPUNIT_TEST(creation);
- CPPUNIT_TEST(testnom);
- CPPUNIT_TEST_SUITE_END();
- fichier *f;
-
- public:
- TermTest() {}
- void creation(){
- f=new fichier("toto.txt",10);
- }
- void testnom(){
- int t = f->getTaille();
- //CPPUNIT_ASSERT_EQUAL(10,10);
- //CPPUNIT_ASSERT_EQUAL(12,12);
- }
- };
- }
|
Lorsque je lance mon test, il bloque sur la ligne : int t = f->getTaille(); avec une erreur de segmentation. Je suppose qu'il doit considerer que l'objet f n'a pas été créer alors qu'il l'a été lors de l'appel creation.
Est ce normal ?
Merci
Message édité par guiguivts le 14-10-2007 à 14:58:07
---------------
http://plainedemazerolles.free.fr