- Timestamp:
- 05/02/17 21:17:25 (7 years ago)
- Location:
- branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Tests/Interpreter/Expressions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Tests/Interpreter/Expressions/FloatExpressionTests.cs
r14834 r14906 1 namespace HeuristicLab.Tests.Interpreter.Expressions 2 { 1 namespace HeuristicLab.Tests.Interpreter.Expressions { 3 2 using System; 4 3 … … 9 8 10 9 [TestClass] 11 public class FloatExpressionTests : CommonTests<double> 12 { 10 public class FloatExpressionTests : CommonTests<double> { 13 11 private const double delta = 0.00001; 14 12 … … 33 31 [TestCategory("ExpressionTest")] 34 32 [TestCategory("FloatExpressionTest")] 35 public void TestAdd() 36 { 33 public void TestAdd() { 37 34 this.interpreter.FloatStack.Push(5.3, 5.3); 38 35 this.interpreter.Run(new FloatAddExpression()); … … 47 44 [TestCategory("ExpressionTest")] 48 45 [TestCategory("FloatExpressionTest")] 49 public void TestAddWithInsufficientArguments() 50 { 46 public void TestAddWithInsufficientArguments() { 51 47 this.TestWithInsufficientArguments("+", 1); 52 48 } … … 56 52 [TestCategory("ExpressionTest")] 57 53 [TestCategory("FloatExpressionTest")] 58 public void TestSubtract() 59 { 54 public void TestSubtract() { 60 55 this.interpreter.FloatStack.Push(10.2, 5.3); 61 56 this.interpreter.Run(new FloatSubtractExpression()); … … 70 65 [TestCategory("ExpressionTest")] 71 66 [TestCategory("FloatExpressionTest")] 72 public void TestSubractWithInsufficientArguments() 73 { 67 public void TestSubractWithInsufficientArguments() { 74 68 this.TestWithInsufficientArguments("-", 1); 75 69 } … … 79 73 [TestCategory("ExpressionTest")] 80 74 [TestCategory("FloatExpressionTest")] 81 public void TestMultiply() 82 { 75 public void TestMultiply() { 83 76 this.interpreter.FloatStack.Push(9.9, 3.3); 84 77 this.interpreter.Run(new FloatMultiplyExpression()); … … 93 86 [TestCategory("ExpressionTest")] 94 87 [TestCategory("FloatExpressionTest")] 95 public void TestMultiplyWithInsufficientArguments() 96 { 88 public void TestMultiplyWithInsufficientArguments() { 97 89 this.TestWithInsufficientArguments("*", 1); 98 90 } … … 102 94 [TestCategory("ExpressionTest")] 103 95 [TestCategory("FloatExpressionTest")] 104 public void TestDivide() 105 { 96 public void TestDivide() { 106 97 this.interpreter.FloatStack.Push(9.9, 3.3); 107 98 this.interpreter.Run(new FloatDivideExpression()); … … 116 107 [TestCategory("ExpressionTest")] 117 108 [TestCategory("FloatExpressionTest")] 118 public void TestDivideWithInsufficientArguments() 119 { 109 public void TestDivideWithInsufficientArguments() { 120 110 this.TestWithInsufficientArguments("/", 1); 121 111 } … … 125 115 [TestCategory("ExpressionTest")] 126 116 [TestCategory("FloatExpressionTest")] 127 public void TestModulo() 128 { 117 public void TestModulo() { 129 118 this.interpreter.FloatStack.Push(11.6, 5.3); 130 119 this.interpreter.Run(new FloatModuloExpression()); … … 139 128 [TestCategory("ExpressionTest")] 140 129 [TestCategory("FloatExpressionTest")] 141 public void TestModuloWithInsufficientArguments() 142 { 130 public void TestModuloWithInsufficientArguments() { 143 131 this.TestWithInsufficientArguments("%", 1); 144 132 } … … 148 136 [TestCategory("ExpressionTest")] 149 137 [TestCategory("FloatExpressionTest")] 150 public void TestMin() 151 { 138 public void TestMin() { 152 139 this.interpreter.FloatStack.Push(10.2, 5.3); 153 140 this.interpreter.Run(new FloatMinExpression()); … … 162 149 [TestCategory("ExpressionTest")] 163 150 [TestCategory("FloatExpressionTest")] 164 public void TestMinWithInsufficientArguments() 165 { 151 public void TestMinWithInsufficientArguments() { 166 152 this.TestWithInsufficientArguments("MIN", 1); 167 153 } … … 171 157 [TestCategory("ExpressionTest")] 172 158 [TestCategory("FloatExpressionTest")] 173 public void TestMax() 174 { 159 public void TestMax() { 175 160 this.interpreter.FloatStack.Push(10.3, 5.3); 176 161 this.interpreter.Run(new FloatMaxExpression()); … … 185 170 [TestCategory("ExpressionTest")] 186 171 [TestCategory("FloatExpressionTest")] 187 public void TestMaxWithInsufficientArguments() 188 { 172 public void TestMaxWithInsufficientArguments() { 189 173 this.TestWithInsufficientArguments("MAX", 1); 190 174 } … … 194 178 [TestCategory("ExpressionTest")] 195 179 [TestCategory("FloatExpressionTest")] 196 public void TestSmallerThan() 197 { 180 public void TestSmallerThan() { 198 181 this.interpreter.FloatStack.Push(10.2, 5.3); 199 182 this.interpreter.Run(new FloatSmallerThanExpression()); … … 208 191 [TestCategory("ExpressionTest")] 209 192 [TestCategory("FloatExpressionTest")] 210 public void TestSmallerThanWithInsufficientArguments() 211 { 193 public void TestSmallerThanWithInsufficientArguments() { 212 194 this.TestWithInsufficientArguments("<", 1); 213 195 } … … 217 199 [TestCategory("ExpressionTest")] 218 200 [TestCategory("FloatExpressionTest")] 219 public void TestGreaterThan() 220 { 201 public void TestGreaterThan() { 221 202 this.interpreter.FloatStack.Push(10.2, 5.3); 222 203 this.interpreter.Run(new FloatGreaterThanExpression()); … … 231 212 [TestCategory("ExpressionTest")] 232 213 [TestCategory("FloatExpressionTest")] 233 public void TestGreaterThanWithInsufficientArguments() 234 { 214 public void TestGreaterThanWithInsufficientArguments() { 235 215 this.TestWithInsufficientArguments(">", 1); 236 216 } … … 240 220 [TestCategory("ExpressionTest")] 241 221 [TestCategory("FloatExpressionTest")] 242 public void TestFromBooleanTrue() 243 { 222 public void TestFromBooleanTrue() { 244 223 this.interpreter.BooleanStack.Push(true); 245 224 this.interpreter.Run(new FloatFromBooleanExpression()); … … 254 233 [TestCategory("ExpressionTest")] 255 234 [TestCategory("FloatExpressionTest")] 256 public void TestFromBooleanFalse() 257 { 235 public void TestFromBooleanFalse() { 258 236 this.interpreter.BooleanStack.Push(false); 259 237 this.interpreter.Run(new FloatFromBooleanExpression()); … … 268 246 [TestCategory("ExpressionTest")] 269 247 [TestCategory("FloatExpressionTest")] 270 public void TestFromBooleanWithInsufficientArguments() 271 { 248 public void TestFromBooleanWithInsufficientArguments() { 272 249 this.TestWithInsufficientArguments("FROMBOOLEAN"); 273 250 } … … 277 254 [TestCategory("ExpressionTest")] 278 255 [TestCategory("FloatExpressionTest")] 279 public void TestFromInteger() 280 { 256 public void TestFromInteger() { 281 257 this.interpreter.IntegerStack.Push(5); 282 258 this.interpreter.Run(new FloatFromIntegerExpression()); … … 291 267 [TestCategory("ExpressionTest")] 292 268 [TestCategory("FloatExpressionTest")] 293 public void TestFromIntegerWithInsufficientArguments() 294 { 269 public void TestFromIntegerWithInsufficientArguments() { 295 270 this.TestWithInsufficientArguments("FROMINTEGER"); 296 271 } … … 300 275 [TestCategory("ExpressionTest")] 301 276 [TestCategory("FloatExpressionTest")] 302 public void TestSine() 303 { 277 public void TestSine() { 304 278 this.interpreter.FloatStack.Push(Math.PI / 2); 305 279 this.interpreter.Run(new FloatSineExpression()); … … 314 288 [TestCategory("ExpressionTest")] 315 289 [TestCategory("FloatExpressionTest")] 316 public void TestSineWithInsufficientArguments() 317 { 290 public void TestSineWithInsufficientArguments() { 318 291 this.TestWithInsufficientArguments("SIN"); 319 292 } … … 323 296 [TestCategory("ExpressionTest")] 324 297 [TestCategory("FloatExpressionTest")] 325 public void TestCosine() 326 { 298 public void TestCosine() { 327 299 this.interpreter.FloatStack.Push(Math.PI); 328 300 this.interpreter.Run(new FloatCosineExpression()); … … 337 309 [TestCategory("ExpressionTest")] 338 310 [TestCategory("FloatExpressionTest")] 339 public void TestCosineWithInsufficientArguments() 340 { 311 public void TestCosineWithInsufficientArguments() { 341 312 this.TestWithInsufficientArguments("COS"); 342 313 } 343 314 344 protected override double[] GetValues(int count) 345 { 315 protected override double[] GetValues(int count) { 346 316 var values = new double[count]; 347 317 … … 351 321 } 352 322 353 protected override void CheckOtherStacksAreEmpty() 354 { 323 protected override void CheckOtherStacksAreEmpty() { 355 324 this.TestStackCounts(floatStack: null); 356 325 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Tests/Interpreter/Expressions/IntegerExpressionTests.cs
r14834 r14906 1 namespace HeuristicLab.Tests.Interpreter.Expressions 2 { 1 namespace HeuristicLab.Tests.Interpreter.Expressions { 3 2 using HeuristicLab.Problems.ProgramSynthesis.Push.Expressions; 4 3 using HeuristicLab.Problems.ProgramSynthesis.Push.Stack; … … 7 6 8 7 [TestClass] 9 public class IntegerExpressionTests : CommonTests<long> 10 { 8 public class IntegerExpressionTests : CommonTests<long> { 11 9 protected override string TypeName 12 10 { … … 29 27 [TestCategory("ExpressionTest")] 30 28 [TestCategory("IntegerExpressionTest")] 31 public void TestAdd() 32 { 29 public void TestAdd() { 33 30 this.interpreter.IntegerStack.Push(5, 5); 34 31 this.interpreter.Run(new IntegerAddExpression()); … … 43 40 [TestCategory("ExpressionTest")] 44 41 [TestCategory("IntegerExpressionTest")] 45 public void TestAddWithInsufficientArguments() 46 { 42 public void TestAddWithInsufficientArguments() { 47 43 this.TestWithInsufficientArguments("+", 1); 48 44 } … … 52 48 [TestCategory("ExpressionTest")] 53 49 [TestCategory("IntegerExpressionTest")] 54 public void TestSubtract() 55 { 50 public void TestSubtract() { 56 51 this.interpreter.IntegerStack.Push(10, 5); 57 52 this.interpreter.Run(new IntegerSubtractExpression()); … … 66 61 [TestCategory("ExpressionTest")] 67 62 [TestCategory("IntegerExpressionTest")] 68 public void TestSubtractWithInsufficientArguments() 69 { 63 public void TestSubtractWithInsufficientArguments() { 70 64 this.TestWithInsufficientArguments("-", 1); 71 65 } … … 75 69 [TestCategory("ExpressionTest")] 76 70 [TestCategory("IntegerExpressionTest")] 77 public void TestMultiply() 78 { 71 public void TestMultiply() { 79 72 this.interpreter.IntegerStack.Push(10, 5); 80 73 this.interpreter.Run(new IntegerMultiplyExpression()); … … 89 82 [TestCategory("ExpressionTest")] 90 83 [TestCategory("IntegerExpressionTest")] 91 public void TestMultiplyWithInsufficientArguments() 92 { 84 public void TestMultiplyWithInsufficientArguments() { 93 85 this.TestWithInsufficientArguments("*", 1); 94 86 } … … 98 90 [TestCategory("ExpressionTest")] 99 91 [TestCategory("IntegerExpressionTest")] 100 public void TestDivide() 101 { 92 public void TestDivide() { 102 93 this.interpreter.IntegerStack.Push(10, 5); 103 94 this.interpreter.Run(new IntegerDivideExpression()); … … 112 103 [TestCategory("ExpressionTest")] 113 104 [TestCategory("IntegerExpressionTest")] 114 public void TestDivideWithInsufficientArguments() 115 { 105 public void TestDivideWithInsufficientArguments() { 116 106 this.TestWithInsufficientArguments("/", 1); 117 107 } … … 121 111 [TestCategory("ExpressionTest")] 122 112 [TestCategory("IntegerExpressionTest")] 123 public void TestModulo() 124 { 113 public void TestModulo() { 125 114 this.interpreter.IntegerStack.Push(10, 5); 126 115 this.interpreter.Run(new IntegerModuloExpression()); … … 135 124 [TestCategory("ExpressionTest")] 136 125 [TestCategory("IntegerExpressionTest")] 137 public void TestModuloWithInsufficientArguments() 138 { 126 public void TestModuloWithInsufficientArguments() { 139 127 this.TestWithInsufficientArguments("%", 1); 140 128 } … … 144 132 [TestCategory("ExpressionTest")] 145 133 [TestCategory("IntegerExpressionTest")] 146 public void TestMin() 147 { 134 public void TestMin() { 148 135 this.interpreter.IntegerStack.Push(10, 5); 149 136 this.interpreter.Run(new IntegerMinExpression()); … … 158 145 [TestCategory("ExpressionTest")] 159 146 [TestCategory("IntegerExpressionTest")] 160 public void TestMinWithInsufficientArguments() 161 { 147 public void TestMinWithInsufficientArguments() { 162 148 this.TestWithInsufficientArguments("MIN", 1); 163 149 } … … 167 153 [TestCategory("ExpressionTest")] 168 154 [TestCategory("IntegerExpressionTest")] 169 public void TestMax() 170 { 155 public void TestMax() { 171 156 this.interpreter.IntegerStack.Push(10, 5); 172 157 this.interpreter.Run(new IntegerMaxExpression()); … … 181 166 [TestCategory("ExpressionTest")] 182 167 [TestCategory("IntegerExpressionTest")] 183 public void TestMaxWithInsufficientArguments() 184 { 168 public void TestMaxWithInsufficientArguments() { 185 169 this.TestWithInsufficientArguments("MAX", 1); 186 170 } … … 190 174 [TestCategory("ExpressionTest")] 191 175 [TestCategory("IntegerExpressionTest")] 192 public void TestSmallerThan() 193 { 176 public void TestSmallerThan() { 194 177 this.interpreter.IntegerStack.Push(10, 5); 195 178 this.interpreter.Run(new IntegerSmallerThanExpression()); … … 204 187 [TestCategory("ExpressionTest")] 205 188 [TestCategory("IntegerExpressionTest")] 206 public void TestSmallerThanWithInsufficientArguments() 207 { 189 public void TestSmallerThanWithInsufficientArguments() { 208 190 this.TestWithInsufficientArguments("<", 1); 209 191 } … … 213 195 [TestCategory("ExpressionTest")] 214 196 [TestCategory("IntegerExpressionTest")] 215 public void TestGreaterThan() 216 { 197 public void TestGreaterThan() { 217 198 this.interpreter.IntegerStack.Push(10, 5); 218 199 this.interpreter.Run(new IntegerGreaterThanExpression()); … … 227 208 [TestCategory("ExpressionTest")] 228 209 [TestCategory("IntegerExpressionTest")] 229 public void TestGreaterThanWithInsufficientArguments() 230 { 210 public void TestGreaterThanWithInsufficientArguments() { 231 211 this.TestWithInsufficientArguments(">", 1); 232 212 } … … 236 216 [TestCategory("ExpressionTest")] 237 217 [TestCategory("IntegerExpressionTest")] 238 public void TestFromBooleanTrue() 239 { 218 public void TestFromBooleanTrue() { 240 219 this.interpreter.BooleanStack.Push(true); 241 220 this.interpreter.Run(new IntegerFromBooleanExpression()); … … 250 229 [TestCategory("ExpressionTest")] 251 230 [TestCategory("IntegerExpressionTest")] 252 public void TestFromBooleanWithInsufficientArguments() 253 { 231 public void TestFromBooleanWithInsufficientArguments() { 254 232 this.TestWithInsufficientArguments("FROMBOOLEAN"); 255 233 } … … 259 237 [TestCategory("ExpressionTest")] 260 238 [TestCategory("IntegerExpressionTest")] 261 public void TestFromBooleanFalse() 262 { 239 public void TestFromBooleanFalse() { 263 240 this.interpreter.BooleanStack.Push(false); 264 241 this.interpreter.Run(new IntegerFromBooleanExpression()); … … 273 250 [TestCategory("ExpressionTest")] 274 251 [TestCategory("IntegerExpressionTest")] 275 public void TestFromFloat() 276 { 252 public void TestFromFloat() { 277 253 this.interpreter.FloatStack.Push(1.5); 278 254 this.interpreter.Run(new IntegerFromFloatExpression()); … … 287 263 [TestCategory("ExpressionTest")] 288 264 [TestCategory("IntegerExpressionTest")] 289 public void TestFromFloatWithInsufficientArguments() 290 { 265 public void TestFromFloatWithInsufficientArguments() { 291 266 this.TestWithInsufficientArguments("FROMFLOAT"); 292 267 } 293 268 294 protected override long[] GetValues(int count) 295 { 269 protected override long[] GetValues(int count) { 296 270 var values = new long[count]; 297 271 … … 301 275 } 302 276 303 protected override void CheckOtherStacksAreEmpty() 304 { 277 protected override void CheckOtherStacksAreEmpty() { 305 278 this.TestStackCounts(integerStack: null); 306 279 }
Note: See TracChangeset
for help on using the changeset viewer.