Thread base theory test

  • 149 views
Uploaded on

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

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

More in: Software
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
149
On Slideshare
0
From Embeds
0
Number of Embeds
3

Actions

Shares
Downloads
1
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 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. [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. [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. [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. [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. [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. [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. [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. [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. ApprovalTests