[Pkg] The Trunk: KernelTests-ul.201.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Sep 17 19:31:25 UTC 2011
Levente Uzonyi uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-ul.201.mcz
==================== Summary ====================
Name: KernelTests-ul.201
Author: ul
Time: 17 September 2011, 5:45:21.421 pm
UUID: 84b36e70-d247-1446-a1b1-b7209db2ceb9
Ancestors: KernelTests-ul.200, KernelTests-ul.199
- merged KernelTests-ul.199
- added a test which checks if ProcessLocalVariable class >> value: returns it's argument
=============== Diff against KernelTests-ul.200 ===============
Item was added:
+ TestCase subclass: #ProcessSpecificTest
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'KernelTests-Processes'!
+
+ !ProcessSpecificTest commentStamp: 'mvl 3/13/2007 13:52' prior: 0!
+ A ProcessSpecificTest is a test case for process local and dynamic variables.
+ !
Item was added:
+ ----- Method: ProcessSpecificTest>>checkDynamic: (in category 'testing') -----
+ checkDynamic: value
+ self assert: TestDynamicVariable value = value!
Item was added:
+ ----- Method: ProcessSpecificTest>>checkLocal: (in category 'testing') -----
+ checkLocal: value
+ self assert: TestLocalVariable value = value!
Item was added:
+ ----- Method: ProcessSpecificTest>>testAssignmentToLocalVariableReturnsTheValue (in category 'testing') -----
+ testAssignmentToLocalVariableReturnsTheValue
+
+ self assert: (TestLocalVariable value: 1) = 1!
Item was added:
+ ----- Method: ProcessSpecificTest>>testDynamicVariable (in category 'testing') -----
+ testDynamicVariable
+
+ | s1 s2 p1stopped p2stopped |
+ s1 := Semaphore new.
+ s2 := Semaphore new.
+ p1stopped := p2stopped := false.
+ [
+ TestDynamicVariable value: 1 during:[
+ self checkDynamic: 1.
+ (Delay forMilliseconds: 30) wait.
+ self checkDynamic: 1.
+ TestDynamicVariable value: 3 during:[
+ (Delay forMilliseconds: 30) wait.
+ self checkDynamic: 3
+ ].
+ self checkDynamic: 1.
+ ].
+ self checkDynamic: nil.
+ p1stopped := true.
+ s1 signal.
+ ] fork.
+
+ [
+ TestDynamicVariable value: 2 during:[
+ self checkDynamic: 2.
+ (Delay forMilliseconds: 30) wait.
+ self checkDynamic: 2.
+ ].
+ self checkDynamic: nil.
+ p2stopped := true.
+ s2 signal.
+ ] fork.
+
+ "Set a maximum wait timeout so that the test case will complete
+ even if the processes fail to signal us."
+ s1 waitTimeoutSeconds: 2.
+ s2 waitTimeoutSeconds: 2.
+ self assert: p1stopped.
+ self assert: p2stopped.!
Item was added:
+ ----- Method: ProcessSpecificTest>>testLocalVariable (in category 'testing') -----
+ testLocalVariable
+
+ | s1 s2 p1stopped p2stopped |
+ s1 := Semaphore new.
+ s2 := Semaphore new.
+ p1stopped := p2stopped := false.
+ [
+ self checkLocal: 0.
+ TestLocalVariable value: 1.
+ self checkLocal: 1.
+ (Delay forMilliseconds: 30) wait.
+ self checkLocal: 1.
+ TestLocalVariable value: 2.
+ self checkLocal: 2.
+ p1stopped := true.
+ s1 signal.
+ ] fork.
+
+ [
+ (Delay forMilliseconds: 30) wait.
+ self checkLocal: 0.
+ TestLocalVariable value: 3.
+ self checkLocal: 3.
+ (Delay forMilliseconds: 30) wait.
+ self checkLocal: 3.
+ TestLocalVariable value: 4.
+ self checkLocal: 4.
+ p2stopped := true.
+ s2 signal.
+ ] fork.
+
+ "Set a maximum wait timeout so that the test case will complete
+ even if the processes fail to signal us."
+ s1 waitTimeoutMSecs: 5000.
+ s2 waitTimeoutMSecs: 5000.
+ self assert: p1stopped.
+ self assert: p2stopped.
+ !
Item was changed:
ClassTestCase subclass: #ProcessTest
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'KernelTests-Processes'!
+
+ !ProcessTest commentStamp: 'ul 8/16/2011 11:35' prior: 0!
+ I hold test cases for generic Process-related behaviour.!
Item was added:
+ ----- Method: ProcessTest>>tearDown (in category 'running') -----
+ tearDown
+ Processor activeProcess environmentRemoveKey: #processTests ifAbsent: []!
Item was added:
+ ----- Method: ProcessTest>>testEnvironmentAt (in category 'testing') -----
+ testEnvironmentAt
+ Processor activeProcess environmentAt: #processTests put: 42.
+ self assert: (Processor activeProcess environmentAt: #processTests) = 42.
+ self should: [Processor activeProcess environmentAt: #foobar] raise: Error!
Item was added:
+ ----- Method: ProcessTest>>testEnvironmentAtPut (in category 'testing') -----
+ testEnvironmentAtPut
+ self assert: (Processor activeProcess environmentAt: #processTests put: 42) = 42.!
Item was added:
+ ----- Method: ProcessTest>>testEnvironmentRemoveKey (in category 'testing') -----
+ testEnvironmentRemoveKey
+ Processor activeProcess environmentAt: #processTests put: 42.
+ Processor activeProcess environmentRemoveKey: #processTests.
+ self assert: (Processor activeProcess environmentAt: #processTests ifAbsent: []) isNil.
+ self should: [Processor activeProcess environmentAt: #processTests] raise: Error!
Item was added:
+ DynamicVariable subclass: #TestDynamicVariable
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'KernelTests-Processes'!
+
+ !TestDynamicVariable commentStamp: 'mvl 3/13/2007 13:51' prior: 0!
+ TestDynamicVariable is a test class using in ProcessSpecificTest.
+
+ !
Item was added:
+ ProcessLocalVariable subclass: #TestLocalVariable
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'KernelTests-Processes'!
+
+ !TestLocalVariable commentStamp: 'mvl 3/13/2007 13:52' prior: 0!
+ TestLocalVariable is a test class using in ProcessSpecificTest.!
Item was added:
+ ----- Method: TestLocalVariable class>>default (in category 'as yet unclassified') -----
+ default
+ "My default value for a new process is 0."
+
+ ^0!
More information about the Packages
mailing list