Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Thread base theory test

522 views

Published on

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

Published in: Software
  • D0WNL0AD FULL ▶ ▶ ▶ ▶ http://1lite.top/eJUsw ◀ ◀ ◀ ◀
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

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

×