Answers for "how to create a test cases for C program"

0

how to create a test cases for C program

// Adds two integer 
    int add(int a, int b) { 
      return a + b; 
    } 
     
    // Testcases 
    int n = 3; 
    int T[n][3] = { 
      { 1, 2, 3 }, 
      { 2, 4, 6 }, 
      { -5, 6, 1} 
    }; 
     
    // Driver method 
    int main() { 
      for (int i = 0; i < n; i++) { 
        int c = add(T[i][0], T[i][1]); 
        assert(c == T[i][2]); 
      } 
    }
Posted by: Guest on February-18-2022

Code answers related to "how to create a test cases for C program"

Browse Popular Code Answers by Language