using assert

I am trying to make test cases for a program that finds and prints the prime factors of a number. So, 100 would print out 2 2 5 5. I have the program written but cannot figure out a test case. any information on how to use it would be appreciated.
One way would be to create a function like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <vector>

typedef std::vector<int> IntVector;

IntVector CalcPrimeFactors(const int number)
{
  IntVector factors;
  
  // do your calculation here and add the factors to the vector
  
  return factors;
}

int main()
{
    cout << "Testing prime factors of 100" << endl;
    IntVector result = CalcPrimeFactors(100);
    
    // Check that the vector contains 4 elements
    // Check that the vector has 2 elements with value2
    // and 2 with value 5
    
    // Show the result
    // repeat for other values
    return 0;
}
Topic archived. No new replies allowed.