github.com/DARA-Project/GoDist-Scheduler@v0.0.0-20201030134746-668de4acea0d/u-benchmarks/propchecker/sample10.prop (about)

     1  package property
     2  //Sample Property file
     3  //A property file should only have function definitions
     4  //and comment for the function. The definition corresponds
     5  //to the property to be checked. The comment provides
     6  //the meta information: Property name and full qualified
     7  //path of each variable in the source package. The full
     8  //qualified path is used for data collection 
     9  //Caveat: The variables used in the property must start
    10  //with an uppercase letter
    11  
    12  //Equality
    13  //main.a
    14  //main.b
    15  func equality(A int, B int) {
    16      return A == B
    17  }
    18  
    19  //SumZero
    20  //main.a
    21  //main.b
    22  func sumZero(A int, B int) {
    23      return A + B == 0
    24  }
    25  
    26  //DiffZero
    27  //main.a
    28  //main.b
    29  func diffZero(A int, B int) {
    30      return A - B == 0
    31  }
    32  
    33  //MultipleZero
    34  //main.a
    35  //main.b
    36  func multipleZero(A int, B int) {
    37      return A == 0 && B == 0
    38  }
    39  
    40  //OnlyOneZero
    41  //main.a
    42  //main.b
    43  func onlyOneZero(A int, B int) {
    44      if A == 0 && B != 0 {
    45          return true
    46      }
    47      if B == 0 && A != 0 {
    48          return true
    49      }
    50  
    51      return false
    52  }
    53  
    54  //AllZero
    55  //main.a
    56  //main.b
    57  //main.c
    58  //main.d
    59  func allZero(A int, B int, C int, D int) {
    60      count := 0
    61      if A == 0 {
    62          count += 1
    63      }
    64      if B == 0 {
    65          count += 1
    66      }
    67      if C == 0 {
    68          count += 1
    69      }
    70      if D == 0 {
    71          count += 1
    72      }
    73      return count == 4
    74  }
    75  
    76  //AllNonZero
    77  //main.a
    78  //main.b
    79  //main.c
    80  //main.d
    81  func allNonZero(A int, B int, C int, D int) {
    82      count := 0
    83      if A != 0 {
    84          count += 1
    85      }
    86      if B != 0 {
    87          count += 1
    88      }
    89      if C != 0 {
    90          count += 1
    91      }
    92      if D != 0 {
    93          count += 1
    94      }
    95      return count == 4    
    96  }
    97  
    98  //TwoPair
    99  //main.a
   100  //main.b
   101  //main.c
   102  //main.d
   103  func twoPair(A int, B int, C int, D int) {
   104      return (A == B && C == D && A != C) || (A == C && B == D && A != B) || (A == D && B == C && A != B)
   105  }
   106  
   107  //AtleastOneZero
   108  //main.a
   109  //main.b
   110  //main.c
   111  //main.d
   112  func atleastOneZero(A int, B int, C int, D int) {
   113      return A == 0 || B == 0 || C == 0 || D == 0
   114  }
   115  
   116  //Inequality
   117  //main.a
   118  //main.b
   119  func inequality(A int, B int) {
   120      return A != B
   121  }