Download - Thread base theory test
![Page 1: Thread base theory test](https://reader035.vdocuments.us/reader035/viewer/2022070302/5487e374b4af9f730d8b5569/html5/thumbnails/1.jpg)
Exploratory Tests
![Page 2: Thread base theory test](https://reader035.vdocuments.us/reader035/viewer/2022070302/5487e374b4af9f730d8b5569/html5/thumbnails/2.jpg)
![Page 3: Thread base theory test](https://reader035.vdocuments.us/reader035/viewer/2022070302/5487e374b4af9f730d8b5569/html5/thumbnails/3.jpg)
? ✓=
![Page 4: Thread base theory test](https://reader035.vdocuments.us/reader035/viewer/2022070302/5487e374b4af9f730d8b5569/html5/thumbnails/4.jpg)
many threads = 1 thread
at a time
![Page 5: Thread base theory test](https://reader035.vdocuments.us/reader035/viewer/2022070302/5487e374b4af9f730d8b5569/html5/thumbnails/5.jpg)
[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);
}
![Page 6: Thread base theory test](https://reader035.vdocuments.us/reader035/viewer/2022070302/5487e374b4af9f730d8b5569/html5/thumbnails/6.jpg)
[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);
}
![Page 7: Thread base theory test](https://reader035.vdocuments.us/reader035/viewer/2022070302/5487e374b4af9f730d8b5569/html5/thumbnails/7.jpg)
[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);
}
![Page 8: Thread base theory test](https://reader035.vdocuments.us/reader035/viewer/2022070302/5487e374b4af9f730d8b5569/html5/thumbnails/8.jpg)
[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);
}
![Page 9: Thread base theory test](https://reader035.vdocuments.us/reader035/viewer/2022070302/5487e374b4af9f730d8b5569/html5/thumbnails/9.jpg)
[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);
}
![Page 10: Thread base theory test](https://reader035.vdocuments.us/reader035/viewer/2022070302/5487e374b4af9f730d8b5569/html5/thumbnails/10.jpg)
[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);
}
![Page 11: Thread base theory test](https://reader035.vdocuments.us/reader035/viewer/2022070302/5487e374b4af9f730d8b5569/html5/thumbnails/11.jpg)
[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);
}
![Page 12: Thread base theory test](https://reader035.vdocuments.us/reader035/viewer/2022070302/5487e374b4af9f730d8b5569/html5/thumbnails/12.jpg)
[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);
}
![Page 13: Thread base theory test](https://reader035.vdocuments.us/reader035/viewer/2022070302/5487e374b4af9f730d8b5569/html5/thumbnails/13.jpg)
[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);
}
![Page 14: Thread base theory test](https://reader035.vdocuments.us/reader035/viewer/2022070302/5487e374b4af9f730d8b5569/html5/thumbnails/14.jpg)
= ErlangHashmap
![Page 15: Thread base theory test](https://reader035.vdocuments.us/reader035/viewer/2022070302/5487e374b4af9f730d8b5569/html5/thumbnails/15.jpg)
= ErlangSimulati on
![Page 16: Thread base theory test](https://reader035.vdocuments.us/reader035/viewer/2022070302/5487e374b4af9f730d8b5569/html5/thumbnails/16.jpg)
ApprovalTests