Thread base theory test

437 views

Published on

Automated Exploratory Multithreaded Race Condition Testing with theory testing api from approvaltests

Published in: Software
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
437
On SlideShare
0
From Embeds
0
Number of Embeds
26
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Thread base theory test

  1. 1. [TestMethod] public void ExplorePossibleRaceCondition() { var random = new Random(); Func<int[]> inputGenerator = () => new int[] { random.Next(1000), random.Next(1000), random.Next(1000) }; Func<int[], string> toString = n => string.Format("{0} + {1} + {2} = ", n[0], n[1], n[2]); var stateCalulator = new StateCalulator(); Func<int[], object> raceConditionsFunction = s=> stateCalulator.Sum(s[0],s[1],s[2]); Func<int[], object> knownGoodFunction = f => new StateCalulator().Sum(f[0],f[1],f[2]); ThreadSafetyTheory.VerifyNoRaceConditions(10000, inputGenerator, toString, raceConditionsFunction, knownGoodFunction); }
  2. 2. [TestMethod] public void ExplorePossibleRaceCondition() { var random = new Random(); Func<int[]> inputGenerator = () => new int[] { random.Next(1000), random.Next(1000), random.Next(1000) }; Func<int[], string> toString = n => string.Format("{0} + {1} + {2} = ", n[0], n[1], n[2]); var stateCalulator = new StateCalulator(); Func<int[], object> raceConditionsFunction = s=> stateCalulator.Sum(s[0],s[1],s[2]); Func<int[], object> knownGoodFunction = f => new StateCalulator().Sum(f[0],f[1],f[2]); ThreadSafetyTheory.VerifyNoRaceConditions(10000, inputGenerator, toString, raceConditionsFunction, knownGoodFunction); }
  3. 3. [TestMethod] public void ExplorePossibleRaceCondition() { var random = new Random(); Func<int[]> inputGenerator = () => new int[] { random.Next(1000), random.Next(1000), random.Next(1000) }; Func<int[], string> toString = n => string.Format("{0} + {1} + {2} = ", n[0], n[1], n[2]); var stateCalulator = new StateCalulator(); Func<int[], object> raceConditionsFunction = s=> stateCalulator.Sum(s[0],s[1],s[2]); Func<int[], object> knownGoodFunction = f => new StateCalulator().Sum(f[0],f[1],f[2]); ThreadSafetyTheory.VerifyNoRaceConditions(10000, inputGenerator, toString, raceConditionsFunction, knownGoodFunction); }
  4. 4. [TestMethod] public void ExplorePossibleRaceCondition() { var random = new Random(); Func<int[]> inputGenerator = () => new int[] { random.Next(1000), random.Next(1000), random.Next(1000) }; Func<int[], string> toString = n => string.Format("{0} + {1} + {2} = ", n[0], n[1], n[2]); var stateCalulator = new StateCalulator(); Func<int[], object> raceConditionsFunction = s=> stateCalulator.Sum(s[0],s[1],s[2]); Func<int[], object> knownGoodFunction = f => new StateCalulator().Sum(f[0],f[1],f[2]); ThreadSafetyTheory.VerifyNoRaceConditions(10000, inputGenerator, toString, raceConditionsFunction, knownGoodFunction); }
  5. 5. [TestMethod] public void ExplorePossibleRaceCondition() { var random = new Random(); Func<int[]> inputGenerator = () => new int[] { random.Next(1000), random.Next(1000), random.Next(1000) }; Func<int[], string> toString = n => string.Format("{0} + {1} + {2} = ", n[0], n[1], n[2]); var stateCalulator = new StateCalulator(); Func<int[], object> raceConditionsFunction = s=> stateCalulator.Sum(s[0],s[1],s[2]); Func<int[], object> knownGoodFunction = f => new StateCalulator().Sum(f[0],f[1],f[2]); ThreadSafetyTheory.VerifyNoRaceConditions(10000, inputGenerator, toString, raceConditionsFunction, knownGoodFunction); }
  6. 6. [TestMethod] public void ExplorePossibleRaceCondition() { var random = new Random(); Func<int[]> inputGenerator = () => new int[] { random.Next(1000), random.Next(1000), random.Next(1000) }; Func<int[], string> toString = n => string.Format("{0} + {1} + {2} = ", n[0], n[1], n[2]); var stateCalulator = new StateCalulator(); Func<int[], object> raceConditionsFunction = s=> stateCalulator.Sum(s[0],s[1],s[2]); Func<int[], object> knownGoodFunction = f => new StateCalulator().Sum(f[0],f[1],f[2]); ThreadSafetyTheory.VerifyNoRaceConditions(10000, inputGenerator, toString, raceConditionsFunction, knownGoodFunction); }
  7. 7. [TestMethod] public void ExplorePossibleRaceCondition() { var random = new Random(); Func<int[]> inputGenerator = () => new int[] { random.Next(1000), random.Next(1000), random.Next(1000) }; Func<int[], string> toString = n => string.Format("{0} + {1} + {2} = ", n[0], n[1], n[2]); var stateCalulator = new StateCalulator(); Func<int[], object> raceConditionsFunction = s=> stateCalulator.Sum(s[0],s[1],s[2]); Func<int[], object> knownGoodFunction = f => new StateCalulator().Sum(f[0],f[1],f[2]); ThreadSafetyTheory.VerifyNoRaceConditions(10000, inputGenerator, toString, raceConditionsFunction, knownGoodFunction); }
  8. 8. [TestMethod] public void ExplorePossibleRaceCondition() { var random = new Random(); Func<int[]> inputGenerator = () => new int[] { random.Next(1000), random.Next(1000), random.Next(1000) }; Func<int[], string> toString = n => string.Format("{0} + {1} + {2} = ", n[0], n[1], n[2]); var stateCalulator = new StateCalulator(); Func<int[], object> raceConditionsFunction = s=> stateCalulator.Sum(s[0],s[1],s[2]); Func<int[], object> knownGoodFunction = f => new StateCalulator().Sum(f[0],f[1],f[2]); ThreadSafetyTheory.VerifyNoRaceConditions(10000, inputGenerator, toString, raceConditionsFunction, knownGoodFunction); }
  9. 9. [TestMethod] public void ExplorePossibleRaceCondition() { var random = new Random(); Func<int[]> inputGenerator = () => new int[] { random.Next(1000), random.Next(1000), random.Next(1000) }; Func<int[], string> toString = n => string.Format("{0} + {1} + {2} = ", n[0], n[1], n[2]); var stateCalulator = new StateCalulator(); Func<int[], object> raceConditionsFunction = s=> stateCalulator.Sum(s[0],s[1],s[2]); Func<int[], object> knownGoodFunction = f => new StateCalulator().Sum(f[0],f[1],f[2]); ThreadSafetyTheory.VerifyNoRaceConditions(10000, inputGenerator, toString, raceConditionsFunction, knownGoodFunction); }
  10. 10. ApprovalTests

×