Frank Shearar uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-fbs.256.mcz ==================== Summary ==================== Name: KernelTests-fbs.256 Author: fbs Time: 5 November 2013, 7:09:16.145 pm UUID: 0bdb93b9-b1b6-574f-98bb-0aefc4fac4b1 Ancestors: KernelTests-cmm.255 More #shouldnt:raise: Error removals. ClassBuilderTest's makeFooSubclassOf: methods now return a thing rather than setting an instvar, because really. It's just easier to read, and side effects where unnecessary are bad. =============== Diff against KernelTests-cmm.255 =============== Item was changed: ----- Method: BehaviorTest>>testBehaviorSubclasses (in category 'tests') ----- testBehaviorSubclasses "self run: #testBehaviorSubclasses" | b b2 | b := Behavior new. b superclass: OrderedCollection. b methodDictionary: MethodDictionary new. + - self shouldnt: [b subclasses ] raise: Error. - self shouldnt: [b withAllSubclasses] raise: Error. - self shouldnt: [b allSubclasses] raise: Error. b2 := Behavior new. b2 superclass: b. b2 methodDictionary: MethodDictionary new. + self assert: (b subclasses includes: b2). + self deny: (b subclasses includes: b). + + self assert: (b withAllSubclasses includes: b). + + self assert: (b allSubclasses includes: b2).! - self assert: (b withAllSubclasses includes: b).! Item was changed: ----- Method: BlockClosureTest>>testCull (in category 'tests - evaluating') ----- testCull + self assert: nil equals: ([ ] cull: 1). + self assert: 1 equals: ([ :x | ] cull: 1). - - self shouldnt: [ [ ] cull: 1 ] raise: Error. - self shouldnt: [ [ :x | ] cull: 1 ] raise: Error. self should: [ [ :x :y | ] cull: 1 ] raise: Error. self should: [ [ :x :y :z | ] cull: 1 ] raise: Error. self should: [ [ :x :y :z :a | ] cull: 1 ] raise: Error. self should: [ [ :x :y :z :a :b | ] cull: 1 ] raise: Error. self assert: ([ 0 ] cull: 1) = 0. self assert: ([ :x | x ] cull: 1) = 1 ! Item was changed: ----- Method: BlockClosureTest>>testCullCull (in category 'tests - evaluating') ----- testCullCull + self assert: nil equals: ([ ] cull: 1 cull: 2). + self assert: 1 equals: ([ :x | ] cull: 1 cull: 2). + self assert: 2 equals: ([ :x :y | ] cull: 1 cull: 2). - - self shouldnt: [ [ ] cull: 1 cull: 2 ] raise: Error. - self shouldnt: [ [ :x | ] cull: 1 cull: 2 ] raise: Error. - self shouldnt: [ [ :x :y | ] cull: 1 cull: 2 ] raise: Error. self should: [ [ :x :y :z | ] cull: 1 cull: 2 ] raise: Error. self should: [ [ :x :y :z :a | ] cull: 1 cull: 2 ] raise: Error. self should: [ [ :x :y :z :a :b | ] cull: 1 cull: 2 ] raise: Error. self assert: ([ 0 ] cull: 1 cull: 2) = 0. self assert: ([ :x | x ] cull: 1 cull: 2) = 1. self assert: ([ :x :y | y ] cull: 1 cull: 2) = 2. ! Item was changed: ----- Method: BlockClosureTest>>testCullCullCull (in category 'tests - evaluating') ----- testCullCullCull + self assert: nil equals: ([ ] cull: 1 cull: 2 cull: 3). + self assert: 1 equals: ([ :x | ] cull: 1 cull: 2 cull: 3). + self assert: 2 equals: ([ :x :y | ] cull: 1 cull: 2 cull: 3). + self assert: 3 equals: ([ :x :y :z | ] cull: 1 cull: 2 cull: 3). - - self shouldnt: [ [ ] cull: 1 cull: 2 cull: 3 ] raise: Error. - self shouldnt: [ [ :x | ] cull: 1 cull: 2 cull: 3 ] raise: Error. - self shouldnt: [ [ :x :y | ] cull: 1 cull: 2 cull: 3 ] raise: Error. - self shouldnt: [ [ :x :y :z | ] cull: 1 cull: 2 cull: 3 ] raise: Error. self should: [ [ :x :y :z :a | ] cull: 1 cull: 2 cull: 3 ] raise: Error. self should: [ [ :x :y :z :a :b | ] cull: 1 cull: 2 cull: 3 ] raise: Error. self assert: ([ 0 ] cull: 1 cull: 2 cull: 3) = 0. self assert: ([ :x | x ] cull: 1 cull: 2 cull: 3) = 1. self assert: ([ :x :y | y ] cull: 1 cull: 2 cull: 3) = 2. self assert: ([ :x :y :z | z ] cull: 1 cull: 2 cull: 3) = 3. ! Item was changed: ----- Method: BlockClosureTest>>testCullCullCullCull (in category 'tests - evaluating') ----- testCullCullCullCull + self assert: nil equals: ([ ] cull: 1 cull: 2 cull: 3 cull: 4). + self assert: 1 equals: ([ :x | ] cull: 1 cull: 2 cull: 3 cull: 4). + self assert: 2 equals: ([ :x :y | ] cull: 1 cull: 2 cull: 3 cull: 4). + self assert: 3 equals: ([ :x :y :z | ] cull: 1 cull: 2 cull: 3 cull: 4). + self assert: 4 equals: ([ :x :y :z :a | ] cull: 1 cull: 2 cull: 3 cull: 4). - - self shouldnt: [ [ ] cull: 1 cull: 2 cull: 3 cull: 4 ] raise: Error. - self shouldnt: [ [ :x | ] cull: 1 cull: 2 cull: 3 cull: 4 ] raise: Error. - self shouldnt: [ [ :x :y | ] cull: 1 cull: 2 cull: 3 cull: 4 ] raise: Error. - self shouldnt: [ [ :x :y :z | ] cull: 1 cull: 2 cull: 3 cull: 4 ] raise: Error. - self shouldnt: [ [ :x :y :z :a | ] cull: 1 cull: 2 cull: 3 cull: 4 ] raise: Error. self should: [ [ :x :y :z :a :b | ] cull: 1 cull: 2 cull: 3 cull: 4 ] raise: Error. self assert: ([ 0 ] cull: 1 cull: 2 cull: 3 cull: 4) = 0. self assert: ([ :x | x ] cull: 1 cull: 2 cull: 3 cull: 4) = 1. self assert: ([ :x :y | y ] cull: 1 cull: 2 cull: 3 cull: 4) = 2. self assert: ([ :x :y :z | z ] cull: 1 cull: 2 cull: 3 cull: 4) = 3. self assert: ([ :x :y :z :a | a ] cull: 1 cull: 2 cull: 3 cull: 4) = 4.! Item was changed: ----- Method: ClassBuilderTest>>makeByteVariableSubclassOf: (in category 'utilities') ----- makeByteVariableSubclassOf: aClass + ^ aClass variableByteSubclass: self subClassName - subClass := aClass variableByteSubclass: self subClassName instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: self categoryNameForTemporaryClasses! Item was changed: ----- Method: ClassBuilderTest>>makeIVarsSubclassOf: (in category 'utilities') ----- makeIVarsSubclassOf: aClass + ^ aClass subclass: self subClassName - subClass := aClass subclass: self subClassName instanceVariableNames: 'var3 var4' classVariableNames: '' poolDictionaries: '' category: self categoryNameForTemporaryClasses! Item was changed: ----- Method: ClassBuilderTest>>makeNormalSubclassOf: (in category 'utilities') ----- makeNormalSubclassOf: aClass + ^ aClass subclass: self subClassName - subClass := aClass subclass: self subClassName instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: self categoryNameForTemporaryClasses! Item was changed: ----- Method: ClassBuilderTest>>makeVariableSubclassOf: (in category 'utilities') ----- makeVariableSubclassOf: aClass + ^ aClass variableSubclass: self subClassName - subClass := aClass variableSubclass: self subClassName instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: self categoryNameForTemporaryClasses! Item was changed: ----- Method: ClassBuilderTest>>makeWeakSubclassOf: (in category 'utilities') ----- makeWeakSubclassOf: aClass + ^ aClass weakSubclass: self subClassName - subClass := aClass weakSubclass: self subClassName instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: self categoryNameForTemporaryClasses! Item was changed: ----- Method: ClassBuilderTest>>makeWordVariableSubclassOf: (in category 'utilities') ----- makeWordVariableSubclassOf: aClass + ^ aClass variableWordSubclass: self subClassName - subClass := aClass variableWordSubclass: self subClassName instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: self categoryNameForTemporaryClasses! Item was changed: ----- Method: ClassBuilderTest>>testByteVariableSubclass (in category 'testing - format') ----- testByteVariableSubclass "Ensure that the invariants for superclass/subclass format are preserved" baseClass := Object variableByteSubclass: self baseClassName instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: self categoryNameForTemporaryClasses. [ + subClass := self makeNormalSubclassOf: baseClass. - self shouldnt:[self makeNormalSubclassOf: baseClass] raise: Error. self deny: (subClass isPointers). self assert: (subClass isVariable). self deny: (subClass isWeak). self assert: (subClass isBytes). subClass removeFromSystem. "pointer classes" self should:[self makeIVarsSubclassOf: baseClass] raise: Error. self should:[self makeVariableSubclassOf: baseClass] raise: Error. self should:[self makeWeakSubclassOf: baseClass] raise: Error. "bit classes" + subClass := self makeByteVariableSubclassOf: baseClass. - self shouldnt:[self makeByteVariableSubclassOf: baseClass] raise: Error. self deny: (subClass isPointers). self assert: (subClass isVariable). self deny: (subClass isWeak). self assert: (subClass isBytes). subClass removeFromSystem. self should:[self makeWordVariableSubclassOf: baseClass] raise: Error. ] ensure:[self cleanup].! Item was changed: ----- Method: ClassBuilderTest>>testChangeToVariableSubclass (in category 'testing - format') ----- testChangeToVariableSubclass "Ensure that the invariants for superclass/subclass format are preserved" baseClass := Object subclass: self baseClassName instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: self categoryNameForTemporaryClasses. [ + baseClass := Object variableSubclass: self baseClassName - self shouldnt:[baseClass := Object variableSubclass: self baseClassName instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' + category: self categoryNameForTemporaryClasses. - category: self categoryNameForTemporaryClasses] raise: Error. ] ensure:[self cleanup].! Item was changed: ----- Method: ClassBuilderTest>>testDuplicateClassVariableError (in category 'testing - reshape') ----- testDuplicateClassVariableError baseClass := Object subclass: self baseClassName instanceVariableNames: '' classVariableNames: 'TestVar' poolDictionaries: '' category: self categoryNameForTemporaryClasses. self should:[ subClass := baseClass subclass: self subClassName instanceVariableNames: '' classVariableNames: 'TestVar' poolDictionaries: '' category: self categoryNameForTemporaryClasses ] raise: DuplicateVariableError. [subClass := baseClass subclass: self subClassName instanceVariableNames: '' classVariableNames: 'TestVar' poolDictionaries: '' category: self categoryNameForTemporaryClasses ] on: DuplicateVariableError do:[:ex| self assert: ex superclass == baseClass. self assert: ex variable = 'TestVar'. ex resume. ]. + baseClass := Object subclass: self baseClassName + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: self categoryNameForTemporaryClasses. - self shouldnt:[ - baseClass := Object subclass: self baseClassName - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: self categoryNameForTemporaryClasses. - ] raise: Error. self should:[ baseClass := Object subclass: self baseClassName instanceVariableNames: '' classVariableNames: 'TestVar' poolDictionaries: '' category: self categoryNameForTemporaryClasses. ] raise: DuplicateVariableError. [baseClass := Object subclass: self baseClassName instanceVariableNames: '' classVariableNames: 'TestVar' poolDictionaries: '' category: self categoryNameForTemporaryClasses. ] on: DuplicateVariableError do:[:ex| self assert: ex superclass == baseClass. self assert: ex variable = 'TestVar'. ex resume. ].! Item was changed: ----- Method: ClassBuilderTest>>testDuplicateInstanceVariableError (in category 'testing - reshape') ----- testDuplicateInstanceVariableError baseClass := Object subclass: self baseClassName instanceVariableNames: 'var' classVariableNames: '' poolDictionaries: '' category: self categoryNameForTemporaryClasses. self should:[ subClass := baseClass subclass: self subClassName instanceVariableNames: 'var' classVariableNames: '' poolDictionaries: '' category: self categoryNameForTemporaryClasses ] raise: DuplicateVariableError. [subClass := baseClass subclass: self subClassName instanceVariableNames: 'var' classVariableNames: '' poolDictionaries: '' category: self categoryNameForTemporaryClasses ] on: DuplicateVariableError do:[:ex| self assert: ex superclass == baseClass. self assert: ex variable = 'var'. ex resume. ]. + baseClass := Object subclass: self baseClassName + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: self categoryNameForTemporaryClasses. - self shouldnt:[ - baseClass := Object subclass: self baseClassName - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: self categoryNameForTemporaryClasses. - ] raise: Error. self should:[ baseClass := Object subclass: self baseClassName instanceVariableNames: 'var' classVariableNames: '' poolDictionaries: '' category: self categoryNameForTemporaryClasses. ] raise: DuplicateVariableError. [baseClass := Object subclass: self baseClassName instanceVariableNames: 'var' classVariableNames: '' poolDictionaries: '' category: self categoryNameForTemporaryClasses. ] on: DuplicateVariableError do:[:ex| self assert: ex superclass == baseClass. self assert: ex variable = 'var'. ex resume. ].! Item was changed: ----- Method: ClassBuilderTest>>testSubclass (in category 'testing - format') ----- testSubclass "Ensure that the invariants for superclass/subclass format are preserved" baseClass := Object subclass: self baseClassName instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: self categoryNameForTemporaryClasses. [ + subClass := self makeNormalSubclassOf: baseClass. - self shouldnt:[self makeNormalSubclassOf: baseClass] raise: Error. self assert: (subClass isPointers). self deny: (subClass isVariable). self deny: (subClass isWeak). self deny: (subClass isBytes). subClass removeFromSystem. "pointer classes" + subClass := self makeIVarsSubclassOf: baseClass. - self shouldnt:[self makeIVarsSubclassOf: baseClass] raise: Error. self assert: (subClass isPointers). self deny: (subClass isVariable). self deny: (subClass isWeak). self deny: (subClass isBytes). subClass removeFromSystem. + subClass := self makeVariableSubclassOf: baseClass. - self shouldnt:[self makeVariableSubclassOf: baseClass] raise: Error. self assert: (subClass isPointers). self assert:(subClass isVariable). self deny: (subClass isWeak). self deny: (subClass isBytes). subClass removeFromSystem. + subClass := self makeWeakSubclassOf: baseClass. - self shouldnt:[self makeWeakSubclassOf: baseClass] raise: Error. self assert: (subClass isPointers). self assert:(subClass isVariable). self assert:(subClass isWeak). self deny: (subClass isBytes). subClass removeFromSystem. "bit classes" + subClass := self makeByteVariableSubclassOf: baseClass. - self shouldnt:[self makeByteVariableSubclassOf: baseClass] raise: Error. self deny: (subClass isPointers). self assert: (subClass isVariable). self deny: (subClass isWeak). self assert: (subClass isBytes). subClass removeFromSystem. + subClass := self makeWordVariableSubclassOf: baseClass. - self shouldnt:[self makeWordVariableSubclassOf: baseClass] raise: Error. self deny: (subClass isPointers). self assert: (subClass isVariable). self deny: (subClass isWeak). self deny: (subClass isBytes). subClass removeFromSystem. ] ensure:[self cleanup].! Item was changed: ----- Method: ClassBuilderTest>>testSubclassWithInstanceVariables (in category 'testing - format') ----- testSubclassWithInstanceVariables "Ensure that the invariants for superclass/subclass format are preserved" baseClass := Object subclass: self baseClassName instanceVariableNames: 'var1 var2' classVariableNames: '' poolDictionaries: '' category: self categoryNameForTemporaryClasses. [ + subClass := self makeNormalSubclassOf: baseClass. - self shouldnt:[self makeNormalSubclassOf: baseClass] raise: Error. self assert: (subClass isPointers). self deny: (subClass isVariable). self deny: (subClass isWeak). self deny: (subClass isBytes). subClass removeFromSystem. "pointer classes" + subClass := self makeIVarsSubclassOf: baseClass. - self shouldnt:[self makeIVarsSubclassOf: baseClass] raise: Error. self assert: (subClass isPointers). self deny: (subClass isVariable). self deny: (subClass isWeak). self deny: (subClass isBytes). subClass removeFromSystem. + subClass := self makeVariableSubclassOf: baseClass. - self shouldnt:[self makeVariableSubclassOf: baseClass] raise: Error. self assert: (subClass isPointers). self assert: (subClass isVariable). self deny: (subClass isWeak). self deny: (subClass isBytes). subClass removeFromSystem. + subClass := self makeWeakSubclassOf: baseClass. - self shouldnt:[self makeWeakSubclassOf: baseClass] raise: Error. self assert: (subClass isPointers). self assert: (subClass isVariable). self assert: (subClass isWeak). self deny: (subClass isBytes). subClass removeFromSystem. "bit classes" self should:[self makeByteVariableSubclassOf: baseClass] raise: Error. self should:[self makeWordVariableSubclassOf: baseClass] raise: Error. ] ensure:[self cleanup].! Item was changed: ----- Method: ClassBuilderTest>>testVariableSubclass (in category 'testing - format') ----- testVariableSubclass "Ensure that the invariants for superclass/subclass format are preserved" baseClass := Object variableSubclass: self baseClassName instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: self categoryNameForTemporaryClasses. [ "pointer classes" + subClass := self makeNormalSubclassOf: baseClass. - self shouldnt:[self makeNormalSubclassOf: baseClass] raise: Error. self assert: (subClass isPointers). self assert: (subClass isVariable). self deny: (subClass isWeak). self deny: (subClass isBytes). subClass removeFromSystem. + subClass := self makeIVarsSubclassOf: baseClass. - self shouldnt:[self makeIVarsSubclassOf: baseClass] raise: Error. self assert: (subClass isPointers). self assert: (subClass isVariable). self deny: (subClass isWeak). self deny: (subClass isBytes). subClass removeFromSystem. + subClass := self makeVariableSubclassOf: baseClass. - self shouldnt:[self makeVariableSubclassOf: baseClass] raise: Error. self assert: (subClass isPointers). self assert: (subClass isVariable). self deny: (subClass isWeak). self deny: (subClass isBytes). subClass removeFromSystem. + subClass := self makeWeakSubclassOf: baseClass. - self shouldnt:[self makeWeakSubclassOf: baseClass] raise: Error. self assert: (subClass isPointers). self assert: (subClass isVariable). self assert: (subClass isWeak). self deny: (subClass isBytes). subClass removeFromSystem. "bit classes" self should:[self makeByteVariableSubclassOf: baseClass] raise: Error. self should:[self makeWordVariableSubclassOf: baseClass] raise: Error. ] ensure:[self cleanup].! Item was changed: ----- Method: ClassBuilderTest>>testWeakSubclass (in category 'testing - format') ----- testWeakSubclass "Ensure that the invariants for superclass/subclass format are preserved" baseClass := Object weakSubclass: self baseClassName instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: self categoryNameForTemporaryClasses. [ "pointer classes" + subClass := self makeNormalSubclassOf: baseClass. - self shouldnt:[self makeNormalSubclassOf: baseClass] raise: Error. self assert: (subClass isPointers). self assert: (subClass isVariable). self assert: (subClass isWeak). self deny: (subClass isBytes). subClass removeFromSystem. + subClass := self makeIVarsSubclassOf: baseClass. - self shouldnt:[self makeIVarsSubclassOf: baseClass] raise: Error. self assert: (subClass isPointers). self assert: (subClass isVariable). self assert: (subClass isWeak). self deny: (subClass isBytes). subClass removeFromSystem. + subClass := self makeVariableSubclassOf: baseClass. - self shouldnt:[self makeVariableSubclassOf: baseClass] raise: Error. self assert: (subClass isPointers). self assert: (subClass isVariable). self deny: (subClass isWeak). self deny: (subClass isBytes). subClass removeFromSystem. + subClass := self makeWeakSubclassOf: baseClass. - self shouldnt:[self makeWeakSubclassOf: baseClass] raise: Error. self assert: (subClass isPointers). self assert: (subClass isVariable). self assert: (subClass isWeak). self deny: (subClass isBytes). subClass removeFromSystem. "bit classes" self should:[self makeByteVariableSubclassOf: baseClass] raise: Error. self should:[self makeWordVariableSubclassOf: baseClass] raise: Error. ] ensure:[self cleanup].! Item was changed: ----- Method: ClassBuilderTest>>testWordVariableSubclass (in category 'testing - format') ----- testWordVariableSubclass "Ensure that the invariants for superclass/subclass format are preserved" baseClass := Object variableWordSubclass: self baseClassName instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: self categoryNameForTemporaryClasses. [ + subClass := self makeNormalSubclassOf: baseClass. - self shouldnt:[self makeNormalSubclassOf: baseClass] raise: Error. self deny: (subClass isPointers). self assert: (subClass isVariable). self deny: (subClass isWeak). self deny: (subClass isBytes). subClass removeFromSystem. "pointer classes" self should:[self makeIVarsSubclassOf: baseClass] raise: Error. self should:[self makeVariableSubclassOf: baseClass] raise: Error. self should:[self makeWeakSubclassOf: baseClass] raise: Error. "bit classes" self should:[self makeByteVariableSubclassOf: baseClass] raise: Error. + subClass := self makeWordVariableSubclassOf: baseClass. - self shouldnt:[self makeWordVariableSubclassOf: baseClass] raise: Error. self deny: (subClass isPointers). self assert: (subClass isVariable). self deny: (subClass isWeak). self deny: (subClass isBytes). subClass removeFromSystem. - ] ensure:[self cleanup].! Item was changed: ----- Method: ClassTest>>testCompileAll (in category 'testing - compiling') ----- testCompileAll + "We expect this to succeed." + ClassTest compileAll.! - - self shouldnt: [ClassTest compileAll] raise: Error.! Item was changed: ----- Method: DateAndTimeTest>>testErrorWhenDayIsAfterMonthEnd (in category 'Tests') ----- testErrorWhenDayIsAfterMonthEnd self should: [DateAndTime year: 2004 month: 2 day: 30] + raise: Error.! - raise: Error. - - self - shouldnt: - [DateAndTime - year: 2004 - month: 2 - day: 29] - raise: Error. - ! Item was changed: ----- Method: DateAndTimeTest>>testErrorWhenDayIsBeforeMonthStart (in category 'Tests') ----- testErrorWhenDayIsBeforeMonthStart self should: [DateAndTime year: 2004 month: 2 day: -1] raise: Error. self should: [DateAndTime year: 2004 month: 2 day: 0] + raise: Error.! - raise: Error. - - self - shouldnt: - [DateAndTime - year: 2004 - month: 2 - day: 1] - raise: Error. - ! Item was changed: ----- Method: DelayTest>>testBounds (in category 'testing-limits') ----- testBounds "self run: #testBounds" self should: [Delay forMilliseconds: -1] raise: Error. + + "We expect these to succeed." + Delay forMilliseconds: SmallInteger maxVal + 1. + (Delay forMilliseconds: Float pi) wait. "Wait 3ms" - self shouldnt: [Delay forMilliseconds: SmallInteger maxVal + 1] raise: Error. - self shouldnt: [(Delay forMilliseconds: Float pi) wait] raise: Error. "Wait 3ms" ! Item was changed: ----- Method: DurationTest>>testAgo (in category 'testing') ----- testAgo - - self shouldnt: [10 hours ago] raise: Error. - self shouldnt: [0 seconds ago] raise: Error. - self shouldnt: [-5 days ago] raise: Error. self assert: ((10 minutes ago) isMemberOf: DateAndTime). self assert: ((10 weeks ago) < DateAndTime now). + self assert: ((-50 seconds ago) > DateAndTime now). + self assert: ((10 hours ago) < DateAndTime now). + self assert: (0 seconds ago - DateAndTime now < 1 second).! - self assert: ((-50 seconds ago) > DateAndTime now).! Item was changed: ----- Method: DurationTest>>testFromNow (in category 'testing') ----- testFromNow + self assert: ((10 seconds fromNow) > DateAndTime now). + self assert: ((0 days fromNow - DateAndTime now) < 1 second). + self assert: ((-1 weeks fromNow) < DateAndTime now). - self shouldnt: [10 seconds fromNow] raise: Error. - self shouldnt: [0 days fromNow] raise: Error. - self shouldnt: [-1 weeks fromNow] raise: Error. self assert: ((1000 milliSeconds fromNow) isMemberOf: DateAndTime). self assert: ((250 hours fromNow) > DateAndTime now). self assert: ((-50 minutes fromNow) < DateAndTime now).! Item was changed: ----- Method: FloatTest>>testDegreeCos (in category 'tests - mathematical functions') ----- testDegreeCos - self shouldnt: [ 45.0 degreeCos] raise: Error. "Following tests use approximate equality, because cosine are generally evaluated using inexact Floating point arithmetic" self assert: (45.0 degreeCos squared - 0.5) abs <= Float epsilon. self assert: (60.0 degreeCos - 0.5) abs <= Float epsilon. self assert: (120.0 degreeCos + 0.5) abs <= Float epsilon. -360.0 to: 360.0 do: [:i | self assert: (i degreeCos closeTo: i degreesToRadians cos)]. "Following tests use strict equality which is a requested property of degreeCos" -10.0 to: 10.0 do: [:k | self assert: (k*360 + 90) degreeCos = 0. self assert: (k*360 - 90) degreeCos = 0. self assert: (k*360 + 180) degreeCos + 1 = 0. self assert: (k*360) degreeCos - 1 = 0.].! Item was changed: ----- Method: FloatTest>>testDegreeSin (in category 'tests - mathematical functions') ----- testDegreeSin - self shouldnt: [ 45.0 degreeSin] raise: Error. "Following tests use approximate equality, because sine are generally evaluated using inexact Floating point arithmetic" self assert: (45.0 degreeSin squared - 0.5) abs <= Float epsilon. self assert: (30.0 degreeSin - 0.5) abs <= Float epsilon. self assert: (-30.0 degreeSin + 0.5) abs <= Float epsilon. -360.0 to: 360.0 do: [:i | self assert: (i degreeSin closeTo: i degreesToRadians sin)]. "Following tests use strict equality which is a requested property of degreeSin" -10.0 to: 10.0 do: [:k | self assert: (k*360 + 90) degreeSin - 1 = 0. self assert: (k*360 - 90) degreeSin + 1= 0. self assert: (k*360 + 180) degreeSin = 0. self assert: (k*360) degreeSin = 0.].! Item was changed: ----- Method: FractionTest>>testDegreeCos (in category 'tests - mathematical functions') ----- testDegreeCos "self run: #testDegreeCos" - self shouldnt: [ (4/3) degreeCos] raise: Error. -361/3 to: 359/3 do: [:i | self assert: (i degreeCos closeTo: i degreesToRadians cos)].! Item was changed: ----- Method: FractionTest>>testDegreeSin (in category 'tests - mathematical functions') ----- testDegreeSin "self run: #testDegreeSin" + - - self shouldnt: [ (4/3) degreeSin] raise: Error. -361/3 to: 359/3 do: [:i | self assert: (i degreeSin closeTo: i degreesToRadians sin)].! Item was changed: ----- Method: InstVarRefLocatorTest>>testInstructions (in category 'tests') ----- testInstructions - - - Object methodDict do: [:method | | scanner printer end | scanner := InstructionStream on: method. printer := InstVarRefLocator new. end := scanner method endPC. [scanner pc <= end] whileTrue: [ + printer interpretNextInstructionUsing: scanner. - self shouldnt: [printer interpretNextInstructionUsing: scanner] raise: Error. ]. ].! Item was changed: ----- Method: InstructionClientTest>>testInstructions (in category 'tests') ----- testInstructions "just interpret all of methods of Object" | client | client := InstructionClient new. Object methodDict do: [:method | + | scanner | + scanner := (InstructionStream on: method). + [scanner pc <= method endPC] whileTrue: [ + scanner interpretNextInstructionFor: client]]. - | scanner | - scanner := (InstructionStream on: method). - [scanner pc <= method endPC] whileTrue: [ - self shouldnt: [scanner interpretNextInstructionFor: client] raise: Error. - ]. - ]. ! Item was changed: ----- Method: InstructionPrinterTest>>testInstructions (in category 'tests') ----- testInstructions "just print all of methods of Object and see if no error accours" | printer | printer := InstructionPrinter. Object methodDict do: [:method | + String streamContents: [:stream | + (printer on: method) printInstructionsOn: stream]]. - self shouldnt: [ - String streamContents: [:stream | - (printer on: method) printInstructionsOn: stream]] raise: Error. - ]. ! Item was changed: ----- Method: IntegerTest>>testDegreeCos (in category 'tests - mathematical functions') ----- testDegreeCos "self run: #testDegreeCos" - self shouldnt: [ 45 degreeCos] raise: Error. "Following tests use approximate equality, because cosine are generally evaluated using inexact Floating point arithmetic" self assert: (45 degreeCos squared - (1/2)) abs <= Float epsilon. self assert: (60 degreeCos - (1/2)) abs <= Float epsilon. self assert: (120 degreeCos + (1/2)) abs <= Float epsilon. -360 to: 360 do: [:i | self assert: (i degreeCos closeTo: i degreesToRadians cos)]. "Following tests use strict equality which is a requested property of degreeCos" -10 to: 10 do: [:k | self assert: (k*360 + 90) degreeCos = 0. self assert: (k*360 - 90) degreeCos = 0. self assert: (k*360 + 180) degreeCos + 1 = 0. self assert: (k*360) degreeCos - 1 = 0.].! Item was changed: ----- Method: IntegerTest>>testDegreeSin (in category 'tests - mathematical functions') ----- testDegreeSin "self run: #testDegreeSin" - self shouldnt: [ 45 degreeSin] raise: Error. - "Following tests use approximate equality, because sine are generally evaluated using inexact Floating point arithmetic" self assert: (45 degreeSin squared - (1/2)) abs <= Float epsilon. self assert: (30 degreeSin - (1/2)) abs <= Float epsilon. self assert: (-30 degreeSin + (1/2)) abs <= Float epsilon. -360 to: 360 do: [:i | self assert: (i degreeSin closeTo: i degreesToRadians sin)]. "Following tests use strict equality which is a requested property of degreeSin" -10 to: 10 do: [:k | self assert: (k*360 + 90) degreeSin - 1 = 0. self assert: (k*360 - 90) degreeSin + 1= 0. self assert: (k*360 + 180) degreeSin = 0. self assert: (k*360) degreeSin = 0].! Item was changed: ----- Method: MethodPragmaTest>>testReformat (in category 'testing-printing-reformating') ----- testReformat - - self assert: (DisplayScreen class compiledMethodAt: #actualScreenDepth) getSource string = 'actualScreenDepth <primitive: ''primitiveScreenDepth''> ^ Display depth'. - - self shouldnt: [ DisplayScreen class reformatMethodAt: #actualScreenDepth] raise: Error. - self assert: (DisplayScreen class compiledMethodAt: #actualScreenDepth) getSource string = 'actualScreenDepth <primitive: ''primitiveScreenDepth''> ^ Display depth'. ! Item was changed: ----- Method: NumberTest>>testPrintShowingDecimalPlaces2 (in category 'tests') ----- testPrintShowingDecimalPlaces2 "This tests problems related to Float>>rounded and Float>>roundTo:: - Float>>#rounded is inexact - Float>>#roundTo: might overflow" "5000000000000001.0 asTrueFraction = 5000000000000001. 5000000000000001 highBit = 53. This number is represented exactly asFloat, it should print exactly" self assert: (5000000000000001.0 printShowingDecimalPlaces: 0) = '5000000000000001'. "50000000000001.25 asTrueFraction = (200000000000005/4). 200000000000005 highBit = 48, 4 isPowerOfTwo, So this number is also represented exactly as Float, it should print exactly. Beware: (50000000000001.25 / 0.01) rounded exhibit the same problem as above." self assert: (50000000000001.25 printShowingDecimalPlaces: 2) = '50000000000001.25'. "This number is close to maximum float value" + self assert: '1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000' equals: (1.0e306 printShowingDecimalPlaces: 3).! - self shouldnt: [1.0e306 printShowingDecimalPlaces: 3] raise: Error.! Item was changed: ----- Method: ObjectTest>>testAssert (in category 'tests - debugging') ----- testAssert + Object assert: [true]. + Object assert: true. - - self shouldnt: [Object assert: [true]] raise: Error. - self shouldnt: [Object assert: true] raise: Error. self should: [Object assert: [false]] raise: AssertionFailure. self should: [Object assert: false] raise: AssertionFailure.! Item was changed: ----- Method: ObjectTest>>testHaltIf (in category 'tests - testing') ----- testHaltIf self should: [self haltIf: true] raise: Halt. + self haltIf: false. - self shouldnt: [self haltIf: false] raise: Halt. self should: [self haltIf: [true]] raise: Halt. + self haltIf: [false]. - self shouldnt: [self haltIf: [false]] raise: Halt. self should: [self haltIf: #testHaltIf.] raise: Halt. + self haltIf: #teadfasdfltIf. - self shouldnt: [self haltIf: #teadfasdfltIf.] raise: Halt. self should: [self a] raise: Halt. + self a1. - self shouldnt: [self a1] raise: Halt. self should: [self haltIf: [:o | o class = self class]] raise: Halt. + self haltIf: [:o | o class ~= self class]. - self shouldnt: [self haltIf: [:o | o class ~= self class]] raise: Halt. ! Item was changed: ----- Method: ProcessTest>>testAtomicSuspend (in category 'tests') ----- testAtomicSuspend "Test atomic suspend of foreign processes" | list p sema | sema := Semaphore new. p := [sema wait] fork. Processor yield. + list := p suspendPrimitivelyOrFail. - self shouldnt: [list := p suspendPrimitivelyOrFail] raise: Error. self assert: list == sema. ! Item was changed: ----- Method: ProtoObjectTest>>testFlag (in category 'tests - testing') ----- testFlag + "This should never throw an exception." + ProtoObject new flag: #hallo.! - - self shouldnt: [ProtoObject new flag: #hallo] raise: Error.! |
Waouh, I don't regret asking 2013/11/5 <[hidden email]> Frank Shearar uploaded a new version of KernelTests to project The Trunk: |
Free forum by Nabble | Edit this page |