Answered step by step
Verified Expert Solution
Question
1 Approved Answer
How would the rules in the below Makefile be written for the below c++ test case? fill the section that says # Need a rule
How would the rules in the below Makefile be written for the below c++ test case? fill the section that says "# Need a rule to build objects"
//Test case | |
#define CATCH_CONFIG_MAIN | |
#include | |
#include "catch/catch.hpp" | |
#include "../foo.hpp" | |
#include "../bar.hpp" | |
#include "../baz.hpp" | |
TEST_CASE("Test Classes. PASS.") | |
{ | |
REQUIRE (Foo.GetMagicNumber() == 12); | |
Bar b = Bar("Hello"); | |
REQUIRE (b.GetString() == "Hello"); | |
Baz *baz = new Baz(90.0 / 9); | |
REQUIRE (baz->GetValue() > 9.999 && baz->GetValue() < 10.0001); | |
} | |
// Compile & run: | |
// make clean test |
//Makefile | |
CXX = g++ | |
CXXFLAGS = -std=c++11 -Wall | |
OBJECTS = # list of .o files. One for each class | |
# Need a rule to build objects | |
testBuild: main | |
$(CXX) $(CXXFLAGS) -Itest/catch/catch.hpp -o test/TestCase $(OBJECTS) test/TestCase.cpp | |
test: clean testBuild | |
test/TestCase --success | |
clean: | |
$(RM) *.o *.gch main test/TestCase |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started