in c++ :
i need three test cases, that test both mass & velocity. Already have written code.
mass |
velocity |
Expected Kinetic Energy |
10 |
9 |
405 |
20 |
5 |
250 |
30 |
7 |
735 |
This is what I have, however I'm not sure how to properly write it so its testing both.
TEST_CASE("Verify Test Configuration", "verification") {
REQUIRE(true == true);
}
TEST_CASE("test")
{
REQUIRE(test_config() == true);
}
TEST_CASE(mass, velocity)
{
REQUIRE(mass(10) && velocity(9) == 405);
}
TEST_CASE(mass, velocity)
{
REQUIRE(mass(20) && velocity(5) == 250);
}
TEST_CASE(mass, velocity)
{
REQUIRE(mass(30) && velocity(7) == 735);
}
Greetings!!
Code:
#include <iostream>
using namespace std;
void test_case(int,int);
void require(int,int);
int main()
{
cout << "mass\tvelocity\tkinetic energy" << endl;
test_case(10,9);
test_case(20,5);
test_case(30,7);
return 0;
}
void test_case(int a, int b)
{
require(a,b);
}
void require(int a,int b)
{
cout << a << "\t";
cout << b << "\t\t";
cout << a*b*b/2 << endl;
}
Output screenshot:
Hope this helps
Get Answers For Free
Most questions answered within 1 hours.