Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 1727: problem with refactoring and boost unittest

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
kolobog007 Posted - Jul 07 2009 : 09:23:04 AM
refactoring is not working with unittest library from boost



i added defines
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_SUITE
to va stdafx.h. before this all variables was underlined. but refactoring still not working.



and still underlined...
13   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jul 18 2009 : 10:23:44 AM
Do you often run more than once instance of the IDE? If so make sure you close all instances of the IDE before doing the symbol database rebuild.

You should only have to do one rebuild and IDE restart, so I am not sure why you are having to do this several times. One rebuild and restart is enough for me.
kolobog007 Posted - Jul 17 2009 : 4:35:05 PM
i added this line yesterday, rebuild symbol database and nothing changed. But after your words i tryed to restart VS n times and rebuild symbol database n times too. And VA started to work normally =)
Thnx a lot for solution =)
feline Posted - Jul 17 2009 : 1:12:35 PM
I am seeing the same problem here, thank you for the clear example I have fixed this by adding:

#define BOOST_CHECK(x)

to VA's StdAfx.h file and doing a symbol database rebuild. So in total I have now added:

#define BOOST_AUTO_TEST_SUITE(x)
#define BOOST_AUTO_TEST_CASE( funcName ) void funcName()
#define BOOST_CHECK_EQUAL(x, y)
#define BOOST_CHECK(x)
#define BOOST_AUTO_TEST_SUITE_END()


to VA's StdAfx.h file. You may need to add more entries if you encounter more Boost unit test macro's that confuse VA.
kolobog007 Posted - Jul 16 2009 : 5:51:23 PM
i think i found reason. refactoring doesn't working with variables, that defined after BOOST_CHECK. Try this code

#include <boost/test/unit_test.hpp>
using namespace std;

#include <iostream>
#include <windows>

class bar{
public:
	bar();
	~bar();
};

void foo()
{
	std::cout << "dummy function";
}

BOOST_AUTO_TEST_SUITE(simple_test_suite) 

BOOST_AUTO_TEST_CASE( simple_test )
{
	RECT rc1;
	rc1.bottom = 5;

	BOOST_CHECK(rc1.bottom == 5);

	RECT rc2;
	rc2.bottom = 3;

	BOOST_CHECK(rc2.bottom != 7);
	
	rc1.bottom = 3;
}

BOOST_AUTO_TEST_SUITE_END()


rc2 underlined and i cant get listbox with member variables or refactor it. but with rc1 no problems even after second BOOST_CHECK.
feline Posted - Jul 16 2009 : 3:00:26 PM
The IDE intellisense should not matter here, since we don't use it for refactoring.

In the solution where this fails, if you copy a problem piece of code and paste it into one of the other solutions, does the code still fail, or does it start to work?

It is possible the problem is the solution settings, its C++ additional include directories maybe.
kolobog007 Posted - Jul 16 2009 : 1:39:00 PM
no differences in code. magic...
may be reason in vs intellisens? not in va.
feline Posted - Jul 11 2009 : 4:23:50 PM
Is there any obvious difference between the code in these two projects? For example are you using different unit testing macro's in the problem project?

This work around should work in all projects or no projects, not just some of them.
kolobog007 Posted - Jul 10 2009 : 3:47:44 PM
in others projects all ok. but in one project - not working...
thnx for help.
feline Posted - Jul 09 2009 : 7:29:43 PM
VA does not underline symbols as mistyped symbols when you first open the file after loading the IDE. This is by design, it is an optimisation to speed things up and to avoid underlining code that you are just browsing but not working on.

Once you make an edit in the file, even a tiny one, then the underlining is activated.

Do the helper macro's in VA StdAfx.h file help at all?
kolobog007 Posted - Jul 09 2009 : 3:49:10 PM
now works fine with this changes, except this - add class/function after
#include <boost/test/unit_test.hpp>

and before

BOOST_AUTO_TEST_SUITE(simple_test)


[ADDED]
magic... now it works normally.
once again thnx for solution =)

[and once again added]
i think i understood how this bug works - when i save project, close VS, open project - all ok. but if i will change any symbol(even just add space in blank line) - VS intellisense and VA lose variables defines.
feline Posted - Jul 09 2009 : 10:59:55 AM
That helps, thank you. My initial code did not compile at all, it was not a linker / missing library problem, it was a totally invalid code problem.

I am not sure exactly what you added to VA's StdAfx.h file from your description, but you need to add something constructive for BOOST_AUTO_TEST_CASE. Try adding the following entries to VA's StdAfx.h file:

#define BOOST_AUTO_TEST_SUITE(x)
#define BOOST_AUTO_TEST_CASE( funcName ) void funcName()
#define BOOST_CHECK_EQUAL(x, y)
#define BOOST_AUTO_TEST_SUITE_END()


on a basic test this is working well for me in VS2005 and VA 1727.
kolobog007 Posted - Jul 09 2009 : 04:34:06 AM
visual studio 2003. boost 1.3x(not important). you must compile unittest libs before using. or use installer - http://www.boostpro.com/download

sample code. new project with "main.cpp". only this code inside

#define BOOST_TEST_MODULE test
#include <boost/test/unit_test.hpp>

BOOST_AUTO_TEST_SUITE(simple_suit) 
BOOST_AUTO_TEST_CASE( simple_test )
{
	int n = 5;
	BOOST_CHECK_EQUAL(n, 5);

}


BOOST_AUTO_TEST_SUITE_END()


or http://www.boost.org/doc/libs/1_39_0/libs/test/doc/html/tutorials/hello-the-testing-world.html for example
feline Posted - Jul 08 2009 : 12:17:37 PM
What do I need to know to setup a valid test for this? Using Boost 1.35.0, VS2005 and VA 1727 I have added the following test code to a cpp file:

#include <boost\\test\\unit_test_suite.hpp>

class cover_simple_polygon { };

BOOST_AUTO_TEST_CASE( cover_simple_polygon )
{
	int column_width = 10;
}

but it does not compile. Since this is invalid code I am not to surprised that VA is confused by it.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000