Jump to content
Sign in to follow this  
Sharad

Compilation error when adding a new test suite

Recommended Posts

Sharad    0

For #3949, I am trying to add a test. I have written minimal test code (following http://trac.wildfiregames.com/wiki/WritingTests)
 

 * You should have received a copy of the GNU General Public License
 * along with 0 A.D.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "lib/self_test.h"

#include "network/NetServer.h"

class TestCNetServerWorker : public CxxTest::TestSuite
{
public:
        void test_duplicate_guid_auth()
        {
        }
}

 

and have followed with update-workspaces. Running "make" now fails with:
 

==== Building test (release) ====
==== Building ActorEditor (release) ====
test_NetServer.h
test_NetServer.cpp
../../../source/network/tests/test_NetServer.cpp:19:29: error: expected initializer before ‘suite_TestCNetServerWorker’
 static TestCNetServerWorker suite_TestCNetServerWorker;
                             ^
../../../source/network/tests/test_NetServer.cpp:22:150: error: ‘suite_TestCNetServerWorker’ was not declared in this scope
 CxxTest::StaticSuiteDescription suiteDescription_TestCNetServerWorker( "../../../source/network/tests/test_NetServer.h", 22, "TestCNetServerWorker", suite_TestCNetServerWorker, Tests_TestCNetServerWorker );
                                                                                                                                                      ^
../../../source/network/tests/test_NetServer.cpp: In member function ‘virtual void TestDescription_suite_TestCNetServerWorker_test_duplicate_guid_auth::runTest()’:
../../../source/network/tests/test_NetServer.cpp:27:19: error: ‘suite_TestCNetServerWorker’ was not declared in this scope
  void runTest() { suite_TestCNetServerWorker.test_duplicate_guid_auth(); }
                   ^
test.make:418: recipe for target 'obj/test_Release/test_NetServer.o' failed
make[1]: *** [obj/test_Release/test_NetServer.o] Error 1
Makefile:92: recipe for target 'test' failed
make: *** [test] Error 2
sbirmi@burnaby:~/0ad-dev/build/workspaces/gcc$

 

Does this look familiar? I am probably overlooking something obvious.

I have compared the generated network/tests/test_NetMessage.cpp and network/tests/test_NetServer.cpp and both seem to have identical declarations.
 

[test_NetServer.cpp]

  7 #define _CXXTEST_HAVE_STD
  8 #include "precompiled.h"
  9 #include "lib/external_libraries/libsdl.h"
 10 #include <cxxtest/TestListener.h>
 11 #include <cxxtest/TestTracker.h>
 12 #include <cxxtest/TestRunner.h>
 13 #include <cxxtest/RealDescriptions.h>
 14 #include <cxxtest/TestMain.h>
 15
 16 bool suite_TestCNetServerWorker_init = false;
 17 #include "/home/sbirmi/0ad-dev/source/network/tests/test_NetServer.h"
 18
 19 static TestCNetServerWorker suite_TestCNetServerWorker;
 20
 21 static CxxTest::List Tests_TestCNetServerWorker = { 0, 0 };


[test_NetMessage.cpp]

  7 #define _CXXTEST_HAVE_STD
  8 #include "precompiled.h"
  9 #include "lib/external_libraries/libsdl.h"
 10 #include <cxxtest/TestListener.h>
 11 #include <cxxtest/TestTracker.h>
 12 #include <cxxtest/TestRunner.h>
 13 #include <cxxtest/RealDescriptions.h>
 14 #include <cxxtest/TestMain.h>
 15
 16 bool suite_TestNetMessage_init = false;
 17 #include "/home/sbirmi/0ad-dev/source/network/tests/test_NetMessage.h"
 18
 19 static TestNetMessage suite_TestNetMessage;
 20
 21 static CxxTest::List Tests_TestNetMessage = { 0, 0 };

 

Thanks,
Sharad

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×