84 lines · cpp
1 2 3 4 5#include <stdio.h>6#include <stdlib.h>7// CHECK: | [[#min(C,4)]]|void func(8void func(int a, int b) {9 bool b0 = a <= b;10 bool b1 = a == b;11 bool b2 = a >= b;12 bool b3 = a < b;13 bool b4 = a > b;14 bool b5 = a != b;15 16 bool c = b0 && // BRCOV: Branch ([[@LINE]]:12): [True: [[#min(C,3)]], False: 1]17 b1 && // BRCOV: Branch ([[@LINE]]:12): [True: [[#min(C,2)]], False: 1]18 b2 && // BRCOV: Branch ([[@LINE]]:12): [True: [[#min(C,2)]], False: 0]19 b3 && // BRCOV: Branch ([[@LINE]]:12): [True: 0, False: [[#min(C,2)]]]20 b4 && // BRCOV: Branch ([[@LINE]]:12): [True: 0, False: 0]21 b5; // BRCOV: Branch ([[@LINE]]:12): [True: 0, False: 0]22 23 bool d = b0 || // BRCOV: Branch ([[@LINE]]:12): [True: [[#min(C,3)]], False: 1]24 b1 || // BRCOV: Branch ([[@LINE]]:12): [True: 0, False: 1]25 b2 || // BRCOV: Branch ([[@LINE]]:12): [True: 1, False: 0]26 b3 || // BRCOV: Branch ([[@LINE]]:12): [True: 0, False: 0]27 b4 || // BRCOV: Branch ([[@LINE]]:12): [True: 0, False: 0]28 b5; // BRCOV: Branch ([[@LINE]]:12): [True: 0, False: 0]29 30 bool e = (b0 && // BRCOV: Branch ([[@LINE]]:13): [True: [[#min(C,3)]], False: 1]31 b5) || // BRCOV: Branch ([[@LINE]]:13): [True: 1, False: [[#min(C,2)]]]32 (b1 && // BRCOV: Branch ([[@LINE]]:13): [True: [[#min(C,2)]], False: 1]33 b4) || // BRCOV: Branch ([[@LINE]]:13): [True: 0, False: [[#min(C,2)]]]34 (b2 && // BRCOV: Branch ([[@LINE]]:13): [True: [[#min(C,3)]], False: 0]35 b3) || // BRCOV: Branch ([[@LINE]]:13): [True: 0, False: [[#min(C,3)]]]36 (b3 && // BRCOV: Branch ([[@LINE]]:13): [True: 0, False: [[#min(C,3)]]]37 b2) || // BRCOV: Branch ([[@LINE]]:13): [True: 0, False: 0]38 (b4 && // BRCOV: Branch ([[@LINE]]:13): [True: 1, False: [[#min(C,2)]]]39 b1) || // BRCOV: Branch ([[@LINE]]:13): [True: 0, False: 1]40 (b5 && // BRCOV: Branch ([[@LINE]]:13): [True: 1, False: [[#min(C,2)]]]41 b0); // BRCOV: Branch ([[@LINE]]:13): [True: 0, False: 1]42 43 bool f = (b0 || // BRCOV: Branch ([[@LINE]]:13): [True: [[#min(C,3)]], False: 1]44 b5) && // BRCOV: Branch ([[@LINE]]:13): [True: 1, False: 0]45 (b1 || // BRCOV: Branch ([[@LINE]]:13): [True: [[#min(C,2)]], False: [[#min(C,2)]]]46 b4) && // BRCOV: Branch ([[@LINE]]:13): [True: 1, False: 1]47 (b2 || // BRCOV: Branch ([[@LINE]]:13): [True: [[#min(C,3)]], False: 0]48 b3) && // BRCOV: Branch ([[@LINE]]:13): [True: 0, False: 0]49 (b3 || // BRCOV: Branch ([[@LINE]]:13): [True: 0, False: [[#min(C,3)]]]50 b2) && // BRCOV: Branch ([[@LINE]]:13): [True: [[#min(C,3)]], False: 0]51 (b4 || // BRCOV: Branch ([[@LINE]]:13): [True: 1, False: [[#min(C,2)]]]52 b1) && // BRCOV: Branch ([[@LINE]]:13): [True: [[#min(C,2)]], False: 0]53 (b5 || // BRCOV: Branch ([[@LINE]]:13): [True: 1, False: [[#min(C,2)]]]54 b0); // BRCOV: Branch ([[@LINE]]:13): [True: [[#min(C,2)]], False: 0]55 56 if (c) // BRCOV: Branch ([[@LINE]]:7): [True: 0, False: [[#min(C,4)]]]57 printf("case0\n");58 else59 printf("case1\n");60 61 if (d) // BRCOV: Branch ([[@LINE]]:7): [True: [[#min(C,4)]], False: 0]62 printf("case2\n");63 else64 printf("case3\n");65 66 if (e) // BRCOV: Branch ([[@LINE]]:7): [True: 1, False: [[#min(C,3)]]]67 printf("case4\n");68 else69 printf("case5\n");70 71 if (f) // BRCOV: Branch ([[@LINE]]:7): [True: [[#min(C,3)]], False: 1]72 printf("case6\n");73 else74 printf("case7\n");75}76 77 78int main(int argc, char *argv[])79{80 func(atoi(argv[1]), atoi(argv[2]));81 (void)0;82 return 0;83}84