Unit Test (I): a tragic Test Tool

Source: Internet
Author: User

The project is over. Perform unit tests as needed and submit the test report. There was a test tool in the company. You can use it directly. But there are actually a bunch of problems, so we don't bother here.

 

(1) The first attempt is the test tool XXTest, but the compilation fails. Open the code and look down:

1         MTString log = "";2         log += "Time: ";3         log += (int)MTTime::GetTime().GetStr();

The string is forcibly converted to int!

 

1     char buff[4096];2     memset(buff, 0x00, 4096);3     sprintf(buff, "%d",(int) ptr);

Print pointer, even forced to int. Will % p be used?

 

I told the support staff that they could not pass the compilation. They replied, "I am doing a good job here. This is what foreigners wrote !".

I guess it may be caused by inconsistent compiling environments. Maybe such code can be passed on their machines, but on my side, there must be a problem (later I confirmed this, their compiler is 4.1, and we are g ++ (Debian 4.7.1-7) 4.7.1 ).

If the problem is not big, fix it first.

 

Continue compilation and report the following error:

1 /usr/bin/ld: Warning: size of symbol `_ZN8MTObjectD1Ev' changed from 8 in /tmp/cc3dhwh4.o to 14 in ./lib/libMTCore.a(MTCore-Linux.o)2 /usr/bin/ld: Warning: size of symbol `_ZN12MTRepositoryD1Ev' changed from 36 in /tmp/cc3dhwh4.o to 44 in ./lib/libMTCore.a(MTCore-Linux.o)3 /usr/bin/ld: i386 architecture of input file `./lib/libMTCore.a(MTCore-Linux.o)' is incompatible with i386:x86-64 output4 ./lib/libMTCore.a(MTCore-Linux.o): In function `MTList::AddBefore(void*)':5 /home/MyTest_Linux_C++/MTCore/MTList.cpp:148: undefined reference to `operator new(unsigned int)'6 ./lib/libMTCore.a(MTCore-Linux.o): In function `MTList::AddAfter(void*)':7 /home/MyTest_Linux_C++/MTCore/MTList.cpp:100: undefined reference to `operator new(unsigned int)'

It seems that "libMTCore. a" is not compatible. This library is prepared by the Support Department and provided to us in advance.

When asked, they are compiled on 32-bit Ubuntu, And we compile on 64-bit Debian (the project requirements cannot be changed). It is strange that they can be linked.

Ask if the 64-bit version is available and the program is no longer maintained.

 

(2) There is a good alternative tool XXX, but the document is very complicated, and the operation process is not detailed and cannot be started.

Ask the support staff and be told that no one has used the service. If you have any questions, Contact HQ. This is a time-and labor-consuming task, and we only have one week. We may have to submit the report if the tool has not been learned. Therefore, the boss decided: don't use these tricks, manually test, or look for external testing tools.

 

(3) c ++ unit testing tools, a lot of open-source tools. Use google test. The code and usage are still relatively simple!

 

PS: after this incident, we have reached our internal comments: next project, go to python! Because no unit test can be written...

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.