-
The main file "example.cpp", which makes use of CAC++ and runs the verifications.
-
The file "student.cpp", which simulates the code implemented by a student.
-
"Makefile" with the following rules (see Setup to configure this file):
-
check: compile and execute the program.
-
clean: clean previous files.
Extract the files and place the folder "Example" in the same directory
as the extracted files of the library
CAC++. Then execute "make check".
cd Example
make check
The program has been implemented to check that:
-
There is a class with the name Example. To that end, the
verification findClass is used.
-
There is a default constructor defined for that class.
To that end, the verification defaultConstructor is used.
-
There is also a method with the name referencedMethod or referredMethod
being invoked within the method mainMethod(int). To that end, the
verification methodWithReferencedMethod is used.
Notes:
-
A wildcard can be used (?) to indicate that we do not want that a
particular parameter in the verification is taken into account,
especially for those cases when the inforamtion is not known or is unimportant.
For instance, it is not relevant whether the involved methods are const or not.
-
A regular expression can be used when there are different alternatives for
the name of a declaration. For instance, in the case of referencedMethod or
referredMethod, we use refer.*edMethod.
The result of the execution should be:
Verifications for the class Example
***********************************
Reuse is not being carried out as indicated in the practice.
-------------------
Review the messages related to the class Example.
The third verification is not being met by the current code in "student.cpp" since
mainMethod is not calling
referencedMethod. Open the file "student.cpp" and replace
mainMethod by:
void mainMethod(int p){
a = referencedMethod() + p;
}
If you compile and execute again with "make check", the result should be:
Verifications for the class Example
***********************************
Class Example correct.