KernelTests

BasicBehaviorClassMetaclassTest
This class contains some tests regarding the classes
Behavior
ClassDescription
Class
Metaclass
---
testBehaviorClassClassDescriptionMetaclassHierarchy
self run: #testBehaviorClassClassDescriptionMetaclassHierarchy
testClassDescriptionAllSubInstances
self run: #testClassDescriptionAllSubInstances
testMetaclass
self run: #testMetaclass
testMetaclassName
self run: #testMetaclassName
testMetaclassNumberOfInstances
self run: #testMetaclassNumberOfInstances
testMetaclassPointOfCircularity
self run: #testMetaclassPointOfCircularity
testMetaclassSuperclass
self run: #testMetaclassSuperclass
testMetaclassSuperclassHierarchy
self run: #testMetaclassSuperclassHierarchy
testObjectAllSubclasses
self run: #testObjectAllSubclasses
testSuperclass
self run: #testSuperclass
BehaviorTest
A BehaviorTest is xxxxxxxxx.
Instance Variables
testAllSelectors
testAllSelectorsAbove
self debug: #testAllSelectorsAbove
testAllSelectorsAboveUntil
self debug: #testAllSelectorsAboveUntil
testBehaviorSubclasses
self run: #testBehaviorSubclasses
testBehaviornewnewShouldNotCrash
testBinding
testChange
self debug: #testChange
testWhichSelectorsAccess
testallSuperclassesIncluding
self debug: #testallSuperclassesIncluding
BlockClosuresTestCase
This test case collects examples for block uses that require full block closures.
comment
The Jensen device was something very sophisticated in the days of Algol 60.
Essentially it was tricky use of a parameter passing policy that was called 'call by name'. In modern terminology, a call by name parameter was a pair of blocks (in a system with full block closures, of course.)
For the lovers of Algol 60, here is a short example:
BEGIN
REAL PROCEDURE JensenSum (A, I, N);
REAL A; INTEGER I, N;
BEGIN
REAL S;
S := 0.0;
FOR I := 1 STEP 1 UNTIL N DO S := S + A;
JensenSum := S;
END;
ARRAY X [1:10], Y[1:10, 1:10];
COMMENT Do array initialization here ;
JensenSum (X[I], I, 10);
JensenSum (Y[I, I], I, 10);
JensenSum(JensenSum(Y[I, J], J, 10), I, 10);
END;
The first call sums the elements of X, the second sums the diagonal elements of Y and the third call sums up all elements of Y.
It is possible to reimplement all this with blocks only and that is what is done in the jensen device examples.
Additional remark:
The Jensen device was something for clever minds. I remember an artice written by Donald Knuth and published in the Communications of the ACM (I think in 1962, but I may err) about that programming trick. That article showed how a simple procedure (called the general problem solver) could be used to do almost anything. The problem was of course to find out the right parameters. I seached my collection of photocopies for that article, but regrettably I could not find it. Perhaps I can find it later.
constructCannotReturnBlockInDeadFrame
constructFibonacciBlockInDeadFrame
constructFibonacciBlockWithBlockArgumentInDeadFrame
constructSharedClosureEnvironmentInDeadFrame
continuationExample1:
see comment below.
Here we simply collect the values of a value with continuation block
continuationExample2:
see comment in method continuationExample1:.
The block named 'processor' takes a value with contiuation
and a processing block. It creates a new value with continuation.
Again we use a collector to collect all values.
continuationExample3:
see comment in method continuationExample1:.
The block named 'processor' takes a value with contiuation
and a processing block. It creates a new value with continuation.
Here we set up a chain of three values with continuation:
one data source and two value processors.
Again we use a collector to collect all values.
example1:
this example is very simple. A named block recursively computes the factorial.
The example tests whether the value of x is still available after the recursive call.
Note that the recursive call precedes the multiplication. For the purpose of the test
this is essential. (When you commute the factors, the example will work also in
some system without block closures, but not in Squeak.)
example2:
BlockClosuresTestCase new example2: 6
gpsExample1:
BlockClosuresTestCase new gpsExample1: (1 to: 100) asArray
gpsExample2:
BlockClosuresTestCase new
gpsExample2: #(#(1 2 3 4 5) #(6 7 8 9 10) #(11 12 13 14 15) #(16 17 18 19 20) #(21 22 23 24 25))
nestedLoopsExample:
A while ago, Hans Baveco asked for a way to
dynamically nest loops. Better solutions than this one
were proposed, but this one is a beautiful test for
recursive block usage.
testCannotReturn
testContinuationExample1
testContinuationExample2
testContinuationExample3
testExample1
testExample2
testGpsExample1
testGpsExample2
integer matrix elements should be used for the purpose of this test.
testNestedLoopsExample1
testReentrantBlock
testReentrantBlockOldEnvironment
testReentrantBlockOldEnvironmentWithBlockArguement
testSharedClosureEnvironment
BlockContextTest
I am an SUnit Test of BlockContext and its supertype ContextPart. See also MethodContextTest.
My fixtures are:
aBlockContext - just some trivial block, i.e., [100@100 corner: 200@200].
NOTES ABOUT AUTOMATING USER INPUTS
When executing non-interactive programs you will inevitably run into programs (like SqueakMap or Monticello installation packages -- and other programs, to be fair) that require user input during their execution and these sort of problems shoot the whole non-interactiveness of your enclosing program.
BlockContext helper methods have been made available and tests of these helpers are provided in this class to demonstrate that it can intercept PopUpMenu and FillInTheBlankMorph requests for user interaction. Of course, PopUpMenu and FillInTheBlankMorph were modified to first signal a ProvideAnswerNotification and if someone handles that (e.g. the enclosing block) then the user interaction will be circumvented and the provided answer of the enclosing block will be used. The basic syntax looks like:
[self confirm: 'Install spyware?'] valueSupplyingAnswer: #('Install spyware?' false)
There a few variants on this theme making it easy to provide a literal list of answers for the block so that you can handle a bunch of questions in a block with appropriate answers.
Additionally, it is possible to suppress Object>>inform: modal dialog boxes as these get in the way of automating anything. After applying this changeset you should be able to tryout the following code snippets to see the variants on this theme that are available.
Examples:
So you don't need any introduction here -- this one works like usual.
[self inform: 'hello'. #done] value.
Now let's suppress all inform: messages.
[self inform: 'hello'; inform: 'there'. #done] valueSuppressingAllMessages.
Here we can just suppress a single inform: message.
[self inform: 'hi'; inform: 'there'. #done] valueSuppressingMessages: #('there')
Here you see how you can suppress a list of messages.
[self inform: 'hi'; inform: 'there'; inform: 'bill'. #done] valueSuppressingMessages: #('hi' 'there')
Enough about inform:, let's look at confirm:. As you see this one works as expected.
[self confirm: 'You like Squeak?'] value
Let's supply answers to one of the questions -- check out the return value.
[{self confirm: 'You like Smalltalk?'. self confirm: 'You like Squeak?'}]
valueSupplyingAnswer: #('You like Smalltalk?' true)
Here we supply answers using only substrings of the questions (for simplicity).
[{self confirm: 'You like Squeak?'. self confirm: 'You like MVC?'}]
valueSupplyingAnswers: #( ('Squeak' true) ('MVC' false) )
This time let's answer all questions exactly the same way.
[{self confirm: 'You like Squeak?'. self confirm: 'You like Morphic?'}]
valueSupplyingAnswer: true

And, of course, we can answer FillInTheBlank questions in the same manner.
[FillInTheBlank request: 'What day is it?']
valueSupplyingAnswer: 'the first day of the rest of your life'

We can also return whatever the initialAnswer of the FillInTheBlank was by using the #default answer.
[FillInTheBlank request: 'What day is it?' initialAnswer: DateAndTime now dayOfWeekName]
valueSupplyingAnswer: #default

Finally, you can also do regex matches on any of the question text (or inform text) (should you have VB-Regex enhancements in your image).
[FillInTheBlank request: 'What day is it?']
valueSupplyingAnswers: { {'What day.*\?'. DateAndTime now dayOfWeekName} }
setUp
testDecompile
testNew
testNoArguments
testOneArgument
testRunSimulated
testSetUp
Note: In addition to verifying that the setUp worked the way it was expected to, testSetUp is used to illustrate the meaning of the simple access methods, methods that are not normally otherwise 'tested'
testSupplyAnswerOfFillInTheBlank
testSupplyAnswerOfFillInTheBlankUsingDefaultAnswer
testSupplyAnswerThroughNestedBlocks
testSupplyAnswerUsingOnlySubstringOfQuestion
testSupplyAnswerUsingRegexMatchOfQuestion
testSupplyAnswerUsingTraditionalMatchOfQuestion
testSupplySameAnswerToAllQuestions
testSupplySeveralAnswersToSeveralQuestions
testSupplySpecificAnswerToQuestion
testSuppressInform
testSuppressInformUsingStringMatchOptions
testTallyInstructions
testTallyMethods
testTrace
testValueWithArguments
testValueWithExitBreak
testValueWithExitContinue
testValueWithPossibleArgs
testValueWithPossibleArgument
BooleanTest
This is the unit test for the class Boolean. Unit tests are a good way to exercise the functionality of your system in a repeatable and automatic manner. They are therefore recommended if you plan to release anything. For more information, see:
- http://www.c2.com/cgi/wiki?UnitTest
- http://minnow.cc.gatech.edu/squeak/1547
- the sunit class category
testBooleanInitializedInstance
testBooleanNew
testNew
ClassBuilderChangeClassTypeTest
A ClassBuilderChangeClassTypeTest is xxxxxxxxx.
Instance Variables
baseClass: <Object>
subClass: <Object>
baseClass
- xxxxx
subClass
- xxxxx
baseClassName
cleanup
ClassBuilderFormatTests
A ClassBuilderFormatTests is xxxxxxxxx.
Instance Variables
baseClass: <Object>
subClass: <Object>
baseClass
- xxxxx
subClass
- xxxxx
baseClassName
cleanup
makeByteVariableSubclassOf:
makeIVarsSubclassOf:
makeNormalSubclassOf:
makeVariableSubclassOf:
makeWeakSubclassOf:
makeWordVariableSubclassOf:
subClassName
testByteVariableSubclass
Ensure that the invariants for superclass/subclass format are preserved
testChangeToVariableSubclass
Ensure that the invariants for superclass/subclass format are preserved
testSubclass
Ensure that the invariants for superclass/subclass format are preserved
testSubclassWithInstanceVariables
Ensure that the invariants for superclass/subclass format are preserved
testVariableSubclass
Ensure that the invariants for superclass/subclass format are preserved
testWeakSubclass
Ensure that the invariants for superclass/subclass format are preserved
testWordVariableSubclass
Ensure that the invariants for superclass/subclass format are preserved
ClassDescriptionTest
This is the unit test for the class ClassDescription. Unit tests are a good way to exercise the functionality of your system in a repeatable and automatic manner. They are therefore recommended if you plan to release anything. For more information, see:
- http://www.c2.com/cgi/wiki?UnitTest
- http://minnow.cc.gatech.edu/squeak/1547
- the sunit class category
testMethods
testOrganization
ClassTest
A ClassTest is xxxxxxxxx.
Instance Variables
className: <Object>
renamedName: <Object>
className
- xxxxx
renamedName
- xxxxx
deleteClass
deleteRenamedClass
setUp
tearDown
testAddInstVarName
self run: #testAddInstVarName
testClassVarNames
testCompileAll
testHaSharedPools
self run: #testHaSharedPools
testRenaming
self debug: #testRenaming
CollectionCombinator
For a collection of collections, enumerate all elements of the cartesian product. The code shows how recursion is used to implement variable nesting of loops.
The cartesian product is usually a huge collection, that should not be kept in memory. Therefore the user of the class has to provide a block with one argument that is called each time a tuple is constructed. When possible, that block should not build a collection of all these tuples, but should immediately drop unsuitable tuples.
To get a first impression, try this with 'inspect it':
| result |
result := OrderedCollection new.
CollectionCombinator new
forArrays: (OrderedCollection with: #(#a #b #c)
with: #(1 2 3 4 5)
with: #('v' 'w' 'x' 'y' 'z')
with: #('one' 'two' 'three')
)
processWith: [:item |result addLast: item].
result
combineFromIdx:
this method is recursive. Recursion runs from values 1 to collectionOfArrays size of parameter myIdx. Each time it is called, this method has the responsiblity to provide all possible values for one index position of the result tuples. That index position is given by the value of myIdx.
forArrays:processWith:
anArray is a kind of a sequenceable collection of arrays.
aBlock is a block with one argument, that is used to process a tuple immediately after it is constructed.
CompiledMethodTest
This is the unit test for the class CompiledMethod. Unit tests are a good way to exercise the functionality of your system in a repeatable and automatic manner. They are therefore recommended if you plan to release anything. For more information, see:
- http://www.c2.com/cgi/wiki?UnitTest
- http://minnow.cc.gatech.edu/squeak/1547
- the sunit class category
readX
readXandY
returnPlusOne:
returnTrue
testDecompile
self debug: #testDecompileTree
testHasInstVarRef
self debug: #testHasInstVarRef
testHasNewPropertyFormat
testIsInstalled
testIsQuick
testMethodClass
testReadsField
self debug: #testReadsField
testSearchForClass
testSearchForSelector
testSelector
testValueWithReceiverArguments
testWritesField
self debug: #testWritesField
writeX
writeXandY
ComplexTest
A ComplexTest is xxxxxxxxx.
Instance Variables
testAbs
self run: #testAbs
testAdding
self run: #testAdding
testArg
self run: #testArg
testBug1
testComplexCollection
self run: #testComplexCollection
testConversion
self run: #testConversion
testCreation
self run: #testCreation
testDivision1
self run: #testDivision1
testEquality
self run: #testEquality
testLn
testNegated
self run: #testNegated
testReciprocal
self run: #testReciprocal
testReciprocalError
self run: #testReciprocalError
testSecureDivision1
self run: #testSecureDivision1
testSecureDivision2
self run: #testSecureDivision2
testSquared
self run: #testSquared
DateAndTimeEpochTest
I represent one of several Sunit test Cases intentended to provide complete coverage for the Chronology set of classes as part of the external testing. The other Chronology sunit test cases are:
DateTestCase
DateAndTimeLeapTestCase,
DurationTestCase,
ScheduleTestCase
TimeStampTestCase
TimespanDoTestCase,
TimespanDoSpanAYearTestCase,
TimespanTestCase,
YearMonthWeekTestCase.
These tests attempt to exercise all public and private methods. Except, they do not explicitly depreciated methods. tlk
My fixtures are:
aDateAndTime = January 01, 1901 midnight (the start of the Squeak epoch) with localTimeZone = Grenwhich Meridian (local offset = 0 hours)
aDuration = 1 day, 2 hours, 3, minutes, 4 seconds and 5 nano seconds.
aTimeZone = 'Epoch Test Time Zone', 'ETZ' , offset: 12 hours, 15 minutes.
setUp
tearDown
testAsDate
testAsDateAndTime
testAsDuration
testAsLocal
testAsMonth
testAsNanoSeconds
testAsSeconds
testAsTime
testAsTimeStamp
testAsUTC
testAsWeek
testAsYear
testCurrent
testDateTime
testDay
testDayMonthYearDo
testDayOfMonth
testDayOfWeek
testDayOfYear
testDaysInMonth
testDaysInYear
testDaysLeftInYear
testDuration
testEpoch
testFirstDayOfMonth
testFromSeconds
testFromString
testHash
testHour
testHour12
testIsLeapYear
testJulianDayNumber
testLessThan
testMeridianAbbreviation
testMiddleOf
testMidnight
testMinus
testMinute
testMinutes
testMonth
testNanoSecond
testNew
testNoon
testNow
testOffset
testPlus
testPrintOn
testSecond
testSeconds
testTicks
testTicksOffset
testTo
testToBy
testToByDo
self assert: (aDateAndTime to: aDateAndTime + 10 days by: 5 days do: []) =
testToday
testTommorrow
testUtcOffset
testYear
testYearDay
testYearDayHourMinuteSecond
testYearMonthDay
testYearMonthDayHourMinuteSecond
testYearMonthDayHourMinuteSecondNanosSecondOffset
testYesterday
testtimeZone
DateAndTimeLeapTest
I represent one of several Sunit test Cases intentended to provide complete coverage for the Chronology set of classes as part of the external testing. tlk.
My fixtures are:
aDateAndTime = February 29, 2004 1:33 PM with offset: 2 hours
aDuration = 15 days, 14 hours, 13 minutes, 12 seconds and 11 nano seconds.
aTimeZone = Grenwhich Meridian (local offset = 0 hours)
setUp
tearDown
testAsDate
testAsDuration
testAsLocal
testAsMonth
testAsNanoSeconds
testAsSeconds
testAsTime
testAsTimeStamp
testAsUTC
testAsWeek
testAsYear
testDay
testDayMonthYearDo
testDayOfMonth
testDayOfWeek
testDayOfYear
testDaysInMonth
testDaysInYear
testDaysLeftInYear
testFirstDayOfMonth
testFromString
testHour
testHour12
testIsLeapYear
testLessThan
testMeridianAbbreviation
testMiddleOf
testMidnight
testMinute
testMinutes
testMonth
testNanoSecond
testNoon
testOffset
testPrintOn
testSecond
testSeconds
testTicks
testTicksOffset
testUtcOffset
testYear
testYearDayHourMinuteSecond
testYearMonthDayHourMinuteSecond
testtimeZone
DateAndTimeTest
A DateAndTimeTest is xxxxxxxxx.
Instance Variables
classToBeTested
selectorsToBeIgnored
testArithmeticAcrossDateBoundary
testDateTimeDenotation1
DateAndTimeTest new testDateTimeDenotation1
testDateTimeDenotation2
DateAndTimeTest new testDateTimeDenotation2
testErrorWhenDayIsAfterMonthEnd
testErrorWhenDayIsBeforeMonthStart
testInstanceCreation
testMonotonicity
testPrintString
(self new setTestSelector: #testPrintString) debug
testReadFromFoolProofExtension
Convenient extension without a time, only a date
testSmalltalk80Accessors
testTimeZoneEquivalence
DateAndTimeTest new testTimeZoneEquivalence
testTimeZoneEquivalence2
DateAndTimeTest new testTimeZoneEquivalence2
DateTest
This is the unit test for the class Date.
classToBeTested
dateClass
selectorsToBeIgnored
setUp
testAccessing
testAddDays
testAddMonths
testArithmetic
testAsDate
testAsSeconds
testComparing
testConverting
testDateAndTimeNow
Not a great test: could falsely fail if midnight come in between the two executions and doesnt catch time errors
testDayMonthYearDo
testDaysInMonthForYear
testDaysInYear
testDuration
testEqual
testFirstWeekdayOfMonthYear
testFromDays
testFromSeconds
testGeneralInquiries
testIndexOfMonth
testInitialization
testInquiries
testJulianDayNumber
testLeap
testLeapNot
testLessThan
testMmddyyyy
testNameOfMonth
testNew
testNewDayMonthYear
testNewDayYear
testPreviousFriday
testPreviousNext
testPreviousThursday
testPrintFormat
testPrintOn
testPrintOnFormat
testPrinting
testReadFrom
testStarting
testStoreOn
testStoring
testSubtractDate
testSubtractDays
testTomorrow
Not a great test: could falsely fail if midnight come in between the two executions and doesnt catch many errors
testWeekday
testYesterday
Not a great test: doesnt catch many errors
testYyyymmdd
DelayTest
A DelayTest is xxxxxxxxx.
Instance Variables
testBounds
self run: #testBounds
testMultiProcessWaitOnSameDelay
Ensure that waiting on the same delay from multiple processes raises an error
testMultiSchedule
Ensure that scheduling the same delay twice raises an error
testSemaphore
When we provide our own semaphore for a Delay, it should be used
DependentsArrayTest
A DependentsArrayTest is xxxxxxxxx.
Instance Variables
testSize
DurationTest
A DurationTest is xxxxxxxxx.
Instance Variables
aDuration: <Object>
aDuration
- xxxxx
classToBeTested
selectorsToBeIgnored
setUp
testAbs
testAsDelay
testAsDuration
testAsMilliSeconds
testAsNanoSeconds
testAsSeconds
testComparing
testDays
testDivide
testFromString
testHash
testHours
testIntegerDivision
testLessThan
testMilliSeconds
testMinus
testMinutes
testModulo
testMonthDurations
testMultiply
testNanoSeconds
testNegated
testNegative
testNew
self assert: Duration new = (Duration seconds: 0).
testNumberConvenienceMethods
testPlus
testPositive
testPrintOn
testQuotient
testReadFrom
testRoundTo
testSeconds
testSecondsNanoSeconds
testStoreOn
testTicks
testTruncateTo
testWeeks
testZero
FalseTest
This is the unit test for the class False. Unit tests are a good way to exercise the functionality of your system in a repeatable and automatic manner. They are therefore recommended if you plan to release anything. For more information, see:
- http://www.c2.com/cgi/wiki?UnitTest
- http://minnow.cc.gatech.edu/squeak/1547
- the sunit class category
testAND
testAnd
testIfFalse
testIfFalseIfTrue
testIfTrue
testIfTrueIfFalse
testNew
testNot
testOR
testOr
testPrintOn
testXor
FloatTest
I provide a test suite for Float values. Examine my tests to see how Floats should behave, and see how to use them.
test32bitGradualUnderflow
method asIEEE32BitWord did not respect IEEE gradual underflow
test32bitRoundingMode
method asIEEE32BitWord did not respect IEEE default rounding mode
testCharacterization
Test the largest finite representable floating point value
testCloseTo
testComparison
test equality when Float conversion loose bits
testComparisonWhenPrimitiveFails
This is related to http://bugs.squeak.org/view.php?id=7361
testContinuedFractions
testDivide
testFloatRounded
5000000000000001 asFloat has an exact representation (no round off error).
It should round to nearest integer without loosing bits.
This is a no regression test on http://bugs.squeak.org/view.php?id=7134
testFloatTruncated
(10 raisedTo: 16) asFloat has an exact representation (no round off error).
It should convert back to integer without loosing bits.
This is a no regression test on http://bugs.impara.de/view.php?id=3504
testFractionAsFloat
use a random test
testFractionAsFloat2
test rounding to nearest even
testHash
testHugeIntegerCloseTo
This is a test for bug http://bugs.squeak.org/view.php?id=7368
testInfinity1
FloatTest new testInfinity1
testInfinity2
FloatTest new testInfinity2
testInfinityCloseTo
This is a test for bug http://bugs.squeak.org/view.php?id=6729:
testIntegerAsFloat
assert IEEE 754 round to nearest even mode is honoured
testIsZero
testNaN1
FloatTest new testNaN1
testNaN2
Two NaN values are always considered to be different.
On an little-endian machine (32 bit Intel), Float nan is 16rFFF80000 16r00000000.
On a big-endian machine (PowerPC), Float nan is 16r7FF80000 16r00000000. Changing
the bit pattern of the first word of a NaN produces another value that is still
considered equal to NaN. This test should work on both little endian and big
endian machines. However, it is not guaranteed to work on future 64 bit versions
of Squeak, for which Float may have different internal representations.
testNaN3
FloatTest new testNaN3
testNaN4
FloatTest new testNaN4
testNaN5
testNaNisLiteral
testRaisedTo
this is a test related to http://bugs.squeak.org/view.php?id=6781
testReadFromManyDigits
A naive algorithm may interpret these representations as Infinity or NaN.
This is http://bugs.squeak.org/view.php?id=6982
testReciprocal
testStoreBase16
This bug was reported in mantis http://bugs.squeak.org/view.php?id=6695
testStringAsNumber
This covers parsing in Number>>readFrom:
testZero1
FloatTest new testZero1
testZeroSignificandAsInteger
This is about http://bugs.squeak.org/view.php?id=6990
FractionTest
A FractionTest is xxxxxxxxx.
Instance Variables
testDegreeCos
self run: #testDegreeCos
testDegreeSin
self run: #testDegreeSin
testFractionPrinting
testReciprocal
IVsAndClassVarNamesConflictTest
An IVsAndClassVarNamesConflictTest is xxxxxxxxx.
Instance Variables
class: <Object>
className: <Object>
class
- xxxxx
className
- xxxxx
setUp
tearDown
testOneCanProceedWhenIntroducingCapitalizedInstanceVariables
testOneCanProceedWhenIntroducingClasseVariablesBeginingWithLowerCaseCharacters
InstVarRefLocatorTest
This is the unit test for the class InstVarRefLocator. Unit tests are a good way to exercise the functionality of your system in a repeatable and automatic manner. They are therefore recommended if you plan to release anything. For more information, see:
- http://www.c2.com/cgi/wiki?UnitTest
- http://minnow.cc.gatech.edu/squeak/1547
- the sunit class category
example1
example2
hasInstVarRef:
Answer whether the receiver references an instance variable.
testExample1
testExample2
testInstructions
InstructionClientTest
This is the unit test for the class InstructionClient. Unit tests are a good way to exercise the functionality of your system in a repeatable and automatic manner. They are therefore recommended if you plan to release anything. For more information, see:
- http://www.c2.com/cgi/wiki?UnitTest
- http://minnow.cc.gatech.edu/squeak/1547
- the sunit class category
testInstructions
just interpret all of methods of Object
InstructionPrinterTest
This is the unit test for the class InstructionPrinter. Unit tests are a good way to exercise the functionality of your system in a repeatable and automatic manner. They are therefore recommended if you plan to release anything. For more information, see:
- http://www.c2.com/cgi/wiki?UnitTest
- http://minnow.cc.gatech.edu/squeak/1547
- the sunit class category
example1
testInstructions
just print all of methods of Object and see if no error accours
IntegerDigitLogicTest
An IntegerDigitLogicTest is xxxxxxxxx.
Instance Variables
testAndSingleBitWithMinusOne
And a single bit with -1 and test for same value
testMixedSignDigitLogic
Verify that mixed sign logic with large integers works.
testNBitAndNNegatedEqualsN
Verify that (n bitAnd: n negated) = n for single bits
testNNegatedEqualsNComplementedPlusOne
Verify that n negated = (n complemented + 1) for single bits
testShiftMinusOne1LeftThenRight
Shift -1 left then right and test for 1
testShiftOneLeftThenRight
Shift 1 bit left then right and test for 1
IntegerTest
An IntegerTest is xxxxxxxxx.
Instance Variables
testBadBase
This used to get into an endless loop.
See Pharo #114
testBenchFib
testBitAt
testBitLogic
This little suite of tests is designed to verify correct operation of most
of Squeak's bit manipulation code, including two's complement
representation of negative values. It was written in a hurry and
is probably lacking several important checks.
testCreationFromBytes1
self run: #testCreationFromBytes1
testCreationFromBytes2
self run: #testCreationFromBytes2
testCreationFromBytes3
self run: #testCreationFromBytes3
testCrossSumBase
self run: #testCrossSumBase
testDegreeCos
self run: #testDegreeCos
testDifferentBases
self run: #testDifferentBases
testEven
testHex
testHighBit
testHighBitOfMagnitude
testIntegerPadding
self run: #testIntegerPadding
testIntegerReadFrom
testIsInteger
testIsPowerOfTwo
testIsPowerOfTwoM6873
This is a non regression test for http://bugs.squeak.org/view.php?id=6873
testIsPrime
The following tests should return 'true'
testLargePrimesUpTo
testLowBit
testNegativeIntegerPrinting
self run: #testnegativeIntegerPrinting
testNew
testNumberOfDigits
testPositiveIntegerPrinting
self run: #testPositiveIntegerPrinting
testPrimesUpTo
testPrintOnBaseShowRadix
testPrintStringBase
testReadFrom
Ensure remaining characters in a stream are not lost when parsing an integer.
testRomanPrinting
testStringAsNumber
This covers parsing in Number>>readFrom:
Trailing decimal points should be ignored.
testTwoComplementBitLogicWithCarry
This is non regression test for http://bugs.squeak.org/view.php?id=6874
testTwoComplementRightShift
self run: #testTwoComplementRightShift
LargeNegativeIntegerTest
A LargeNegativeIntegerTest is xxxxxxxxx.
Instance Variables
testEmptyTemplate
Check that an uninitialized instance behaves reasonably.
LargePositiveIntegerTest
A LargePositiveIntegerTest is xxxxxxxxx.
Instance Variables
testBitShift
Check bitShift from and back to SmallInts
testEmptyTemplate
Check that an uninitialized instance behaves reasonably.
testMultDicAddSub
self run: #testMultDicAddSub
testNormalize
self run: #testNormalize
MethodContextTest
I am an SUnit Test of MethodContext and its super type, ContextPart. See also BlockContextTest.
See pages 430-437 of A. Goldberg and D. Robson's Smalltalk-80 The Language (aka the purple book), which deal with Contexts. My fixtures are from their example. (The Squeak byte codes are not quite the same as Smalltalk-80.)
My fixtures are:
aReceiver - just some arbitrary object, "Rectangle origin: 100@100 corner: 200@200"
aSender - just some arbitrary object, thisContext
aCompiledMethod - just some arbitrary method, "Rectangle rightCenter".
aMethodContext - just some arbitray context ...
setUp
testActivateReturnValue
testFindContextSuchThat
testMethodContext
testMethodIsBottomContext
testReturn
Why am I overriding setUp? Because sender must be thisContext, i.e, testReturn, not setUp.
testSetUp
Note: In addition to verifying that the setUp worked the way it was expected to, testSetUp is used to illustrate the meaning of the simple access methods, methods that are not normally otherwise 'tested'
testTempNamed
testTempNamedPut
MethodPragmaTest
A MethodPragmaTest is xxxxxxxxx.
Instance Variables
assertPragma:givesKeyword:arguments:
compile:selector:
methodCategory
pragma:selector:
pragma:selector:times:
tearDown
testAllNamedFromTo
testAllNamedFromToSortedByArgument
testAllNamedFromToSortedUsing
testAllNamedIn
testAllNamedInSortedByArgument
testAllNamedInSortedUsing
testArgumentAt
testArguments
testCompileArray
testCompileBinary
testCompileCharacter
testCompileEmpty
testCompileFull
testCompileInvalid
Invalid pragmas should properly raise an error.
testCompileNumber
testCompileString
testCompileSymbol
testCompileTemps
Pragmas should be placeable before and after temps.
testCompileValue
testKeyword
testMessage
testMethod
testMethodClass
testNoPragma
testNumArgs
testPrimitiveIndexed1
This test useses the #instVarAt: primitive.
testPrimitiveIndexed2
This test useses the #identityHash primitive.
testPrimitiveNamed1
This test useses the #primitiveDirectoryLookup primitive.
testPrimitiveNamed2
This test useses the #primPathNameDelimiter primitive.
testReformat
testSelector
testSendTo
testWithArgumentsDo
MethodPropertiesTest
A MethodPropertiesTest is xxxxxxxxx.
Instance Variables
method: <Object>
method
- xxxxx
expectedFailures
The new closure compiler does not use MethodProperties. These tests end up performing
their assertions on AdditionalMethodState.
propertyDictionaryFor:
setUp
tearDown
testAllMethodsHaveMethodClass
testAllMethodsHaveNewPropertyFormat
testAnalogousCodeTo
self debug: #testAnalogousCodeTo
testAt
testAtIfAbsent
testAtIfAbsentPut
testAtPut
testIncludesKey
testRemoveKey
testRemoveKeyifAbsent
MonitorTest
A MonitorTest is xxxxxxxxx.
Instance Variables
testExample1
testExample2
Here is a second version that does not use a semaphore to inform the
forking process about termination of both forked processes
MonthTest
This is the unit test for the class Month.
classToBeTested
selectorsToBeIgnored
setUp
tearDown
testConverting
testEnumerating
testInquiries
testInstanceCreation
testPreviousNext
testPrinting
testReadFrom
NumberParsingTest
Tests to verify parsing of numbers from streams and strings.
Note: ScaledDecimalTest contains related tests for parsing ScaledDecimal.
testFloatFromStreamAsNumber
This covers parsing in Number>>readFrom:
testFloatFromStreamWithExponent
This covers parsing in Number>>readFrom:
testFloatFromStringAsNumber
This covers parsing in Number>>readFrom:
testFloatFromStringWithExponent
This covers parsing in Number>>readFrom:
testFloatReadWithRadix
This covers parsing in Number>>readFrom:
Note: In most Smalltalk dialects, the radix notation is not used for numbers
with exponents. In Squeak, a string with radix and exponent can be parsed,
and the exponent is always treated as base 10 (not the base indicated in the
radix prefix). I am not sure if this is a feature, a bug, or both, but the
Squeak behavior is documented in this test. -dtl
testIntegerFromString
This covers parsing in Number>>readFrom:
Trailing decimal points should be ignored.
testIntegerReadFrom
Ensure remaining characters in a stream are not lost when parsing an integer.
testIntegerReadWithRadix
This covers parsing in Number>>readFrom:
Note: In most Smalltalk dialects, the radix notation is not used for numbers
with exponents. In Squeak, a string with radix and exponent can be parsed,
and the exponent is always treated as base 10 (not the base indicated in the
radix prefix). I am not sure if this is a feature, a bug, or both, but the
Squeak behavior is documented in this test. -dtl
testNumberReadExactlyError
This covers parsing in Number>>readExactlyFrom:
testNumberReadOnlyDigit
This covers parsing in Number>>readFrom:
testScaledDecimalWithTrailingZeroes
This is a non regression tests for http://bugs.squeak.org/view.php?id=7169
NumberTest
A NumberTest is xxxxxxxxx.
Instance Variables
testFractionPart
testIntegerPart
testOne
testPrintShowingDecimalPlaces
testPrintShowingDecimalPlaces2
This tests problems related to Float>>rounded and Float>>roundTo::
- Float>>#rounded is inexact
- Float>>#roundTo: might overflow
testPrintShowingDecimalPlaces3
This problem were reported at http://bugs.squeak.org/view.php?id=7028
unfortunate inversion of left / right padding
testRaisedTo
this is a test related to http://bugs.squeak.org/view.php?id=6781
testRaisedToInteger
testRaisedToIntegerWithFloats
testReadFrom
testReciprocal
ObjectTest
An ObjectTest is xxxxxxxxx.
Instance Variables
a
a1
b
b1
testAssert
testBecome
self debug: #testBecome
testBecomeForward
self debug: #testBecomeForward
testHaltIf
ProcessSpecificTest
A ProcessSpecificTest is a test case for process local and dynamic variables.
checkDynamic:
checkLocal:
testDynamicVariable
testLocalVariable
ProcessTest
A ProcessTest holds test cases for generic Process-related behaviour.
tearDown
testEnvironmentAt
testEnvironmentAtPut
testEnvironmentRemoveKey
testIsSelfEvaluating
ProtoObjectTest
This is the unit test for the class ProtoObject. Unit tests are a good way to exercise the functionality of your system in a repeatable and automatic manner. They are therefore recommended if you plan to release anything. For more information, see:
- http://www.c2.com/cgi/wiki?UnitTest
- http://minnow.cc.gatech.edu/squeak/1547
- the sunit class category
testFlag
testIsNil
RandomTest
A RandomTest is xxxxxxxxx.
Instance Variables
gen: <Object>
gen
- xxxxx
setUp
testNext
ScaledDecimalTest
I provide a test suite for ScaledDecimal values. Examine my tests to see how SmallIntegers should behave, and see how to use them.
testAsNumber
Ensure no loss of precision
testAsNumberNegatedWithoutDecimalPoint
testAsNumberNegatedWithoutDecimalPoint2
testAsNumberWithExtendedScale
testAsNumberWithRadix
testAsNumberWithSuperfluousDecimalPoint
testAsNumberWithoutDecimalPoint
testAsNumberWithoutDecimalPoint2
testCoercion
testConvertFromFloat
testConvertFromFraction
testIsLiteral
This test is related to http://bugs.squeak.org/view.php?id=6796
testLiteral
testOneRaisedToInteger
One might be handled specially
testPrintString
The printed representation of a ScaledDecimal is rounded.
Note that old implementation was truncated.
testRaisedToInteger
Raising to integer should preserve class and scale
testReadFrom
This is related to http://bugs.squeak.org/view.php?id=6779
testScaleExtension
The scale is extended to the larger one in case of arithmetic operation
testStoreOn
this is http://bugs.squeak.org/view.php?id=4378
testZeroRaisedToInteger
Zero might be handle specially
ScheduleTest
A ScheduleTest is xxxxxxxxx.
Instance Variables
aSchedule: <Object>
firstEvent: <Object>
restoredTimeZone: <Object>
aSchedule
- xxxxx
firstEvent
- xxxxx
restoredTimeZone
- xxxxx
classToBeTested
selectorsToBeIgnored
setUp
Schedule is a type of Timespan representing repeated occurences of the same event.
The beginning of the schedule is the first occurrence of the event.
A schedule maintains an array of Durations.
Each durations specify the offset to the next scheduled each.
The duration of each occurence of the event is not specified.
Nor are any other attributes such as name
tearDown
testBetweenAndDoDisjointWithSchedule
testBetweenAndDoIncludedInSchedule
testBetweenAndDoOverlappingSchedule
testDateAndTimes
testExampleFromSwikiPage
It is often neccessary to schedule repeated events, like airline flight schedules, TV programmes, and file backups.
Schedule is a Timespan which maintains an array of Durations.
The durations specify the offset to the next scheduled DateAndTime.
testFromDateAndTime
testIncludes
testMonotonicity
testSchedule
SelfEvaluatingObjectTest
A SelfEvaluatingObjectTest is xxxxxxxxx.
Instance Variables
assertCode:print:
compile:
testArray
self run: #testArray
testObjects
self debug: #testObjects
SemaphoreTest
A SemaphoreTest is sunit test for simple and multiEx semaphores
Instance Variables none; does not have common test fixture accross all tests (because its testing differenct sorts of semaphores (could refactor into muliple testcases if there were more test conditions.
criticalError
testCritical
testCriticalIfError
testSemaAfterCriticalWait
self run: #testSemaAfterCriticalWait
testSemaInCriticalWait
self run: #testSemaInCriticalWait
testWaitAndWaitTimeoutTogether
testWaitTimeoutMSecs
Ensure that waitTimeoutMSecs behaves properly
waitAndWaitTimeoutTogether
self run: #testWaitAndWaitTimeoutTogether
SmallIntegerTest
I provide a test suite for SmallInteger values. Examine my tests to see how SmallIntegers should behave, and see how to use them.
testBasicNew
testDivide
testMaxVal
testMinVal
testNew
testPrintPaddedWith
testPrintString
SqNumberParserTest
Provide tests for new clas aimed at parsing numbers.
It duplicates NumberParsingTest, with few more tests.
testFloatFromStreamAsNumber
This covers parsing in Number>>readFrom:
testFloatFromStreamWithExponent
This covers parsing in Number>>readFrom:
testFloatGradualUnderflow
Gradual underflow are tricky.
This is a non regression test for http://bugs.squeak.org/view.php?id=6976
testFloatPrintString
self debug: #testFloatPrintString
testFloatReadError
This covers parsing in Number>>readFrom:
testFloatReadWithRadix
This covers parsing in Number>>readFrom:
Note: In most Smalltalk dialects, the radix notation is not used for numbers
with exponents. In Squeak, a string with radix and exponent can be parsed,
and the exponent is always treated as base 10 (not the base indicated in the
radix prefix). I am not sure if this is a feature, a bug, or both, but the
Squeak behavior is documented in this test. -dtl
testIntegerReadFrom
Ensure remaining characters in a stream are not lost when parsing an integer.
testIntegerReadWithRadix
This covers parsing in Number>>readFrom:
Note: In most Smalltalk dialects, the radix notation is not used for numbers
with exponents. In Squeak, a string with radix and exponent can be parsed,
and the exponent is always treated as base 10 (not the base indicated in the
radix prefix). I am not sure if this is a feature, a bug, or both, but the
Squeak behavior is documented in this test. -dtl
testScaledDecimalWithTrailingZeroes
This is a non regression tests for http://bugs.squeak.org/view.php?id=7169
testcheckForCoverage
Tests for old semantics of Number>>readFrom:
StopwatchTest
A StopwatchTest is xxxxxxxxx.
Instance Variables
aDelay: <Object>
aStopwatch: <Object>
aDelay
- xxxxx
aStopwatch
- xxxxx
classToBeTested
selectorsToBeIgnored
setUp
testActive
testChangingStatus
testInitialStatus
testMultipleTimings
testNew
testPrintOn
testReActivate
testReset
testSingleTiming
testStartStop
TestDynamicVariable
TestDynamicVariable is a test class using in ProcessSpecificTest.
TestLocalVariable
TestLocalVariable is a test class using in ProcessSpecificTest.
default
TimeStampTest
This is the unit test for the class TimeStamp.
classToBeTested
selectorsToBeIgnored
setUp
tearDown
testAccessing
testArithmetic
testArithmeticAcrossDateBoundary
testComparing
testConverting
testDate
testDateAndTime
testFromSeconds
testFromString
This should signal an exception in 3.6beta as Time>>fromString: does not exist.
testInstanceCreation
testMinusDays
testMinusSeconds
testMinusSecondsOverMidnight
testPlusDays
testPlusSeconds
testPlusSecondsOverMidnight
testPrintOn
testPrinting
testReadFromA1
testSorting
testStoreOn
testTime
testTimeStamp
timestampClass
TimeTest
This is the unit test for the class Time.
classToBeTested
selectorsToBeIgnored
setUp
tearDown
testAccessing
testAddSeconds
testAddTime
testArithmetic
testAsDate
testAsDateAndTime
testAsDuration
testAsNanoSeconds
testAsSeconds
testAsTime
testAsTimeStamp
testAsWeek
testAsYear
testComparing
testConverting
testDuration
testEqual
testFromSeconds
testGeneralInquiries
testHhmm24
testHour
testHumanWordsForSecondsAgo
testHumanWordsForSecondsAgoWithDays
testLessThan
testMeridianAbbreviation
testMinute
testNanoSecond
testNew
testPrint24
testPrint24On
testPrint24OnWithPM
testPrint24OnWithoutSeconds
testPrintMinutes
testPrintOn
testPrinting
testReadFrom
testSecond
testSqueakInquiries
testStoreOn
testStoring
testSubtractTime
testTicks
testTimeStamp
timeClass
TimespanDoSpanAYearTest
I am one of several Sunit test Cases intentended to provide complete coverage for the Chronology set of classes as part of the external testing. See DateAndTimeEpochTestCase for a complete list. tlk.
My fixtures include a Timespan that crosses over a year boundary:
aDate = December 25, 2004, midnight
aDuration = 91 days
aTimeSpan= 91 days, starting December 25, 2004, midnight
setUp
testMonthsDo
testNext
testWeeksDo
testYearsDo
TimespanDoTest
I am one of several Sunit test Cases intentended to provide complete coverage for the Chronology set of classes as part of the external testing. See DateAndTimeEpochTestCase for a complete list. tlk.
My fixtures are:
aDate = January 8, 2003, midnight
aDuration = 91 days
aTimeSpan= 91 days, starting January 8, 2003, midnight
setUp
testDatesDo
testDoWith
testDoWithWhen
testEveryDo
testMonthsDo
testNext
testWeeksDo
testYearsDo
TimespanTest
A TimespanTest is xxxxxxxxx.
Instance Variables
aDay: <Object>
aDisjointTimespan: <Object>
aTimespan: <Object>
aWeek: <Object>
anIncludedTimespan: <Object>
anOverlappingTimespan: <Object>
dec31: <Object>
jan01: <Object>
jan08: <Object>
localTimeZoneToRestore: <Object>
timespan: <Object>
aDay
- xxxxx
aDisjointTimespan
- xxxxx
aTimespan
- xxxxx
aWeek
- xxxxx
anIncludedTimespan
- xxxxx
anOverlappingTimespan
- xxxxx
dec31
- xxxxx
jan01
- xxxxx
jan08
- xxxxx
localTimeZoneToRestore
- xxxxx
timespan
- xxxxx
classToBeTested
setUp
tearDown
testAccessing
testArithmetic
testAsDate
testAsDateAndTime
testAsDuration
testAsMonth
testAsTime
testAsTimeStamp
testAsWeek
testAsYear
testClockPrecisionDuration
testCurrent
testDay
testDayOfMonth
testDayOfWeek
testDayOfYear
testDaysInMonth
testDaysInYear
testDaysLeftInYear
testDoWith
testDoWithWhen
testDuration
testEnd
testEveryDo
testFirstDayOfMonth
testIncludes
testIncludesAllOf
testIncludesAnyOf
testInclusion
testIntersectionWithDisjoint
testIntersectionWithIncluded
testIntersectionWithOverlapping
testIntersectionWithSelf
testIntersectionWithSeparate
testIsLeapYear
self assert: anOverlappingTimespan isLeapYear.
testJulianDayNumber
testLessThan
testMinusADateAndTime
It appears that subtracting a date from a Timespan gives you a duration = to the difference between the start of the timespan and the date
testMinusADuration
It appears that subtracting a duration from a Timespan gives you a Timespan shifted by the duration
testMonth
testNew
testNext
testPlus
testPrevious
testPrintOn
testStart
testStartingEnding
testTo
testUnion
testUnionWithDisjoint
testUnionWithIncluded
testUnionWithOverlapping
testUnionWithSelf
testUnionWithSeparate
testWorkDatesDo
testYear
testZeroDuration
TrueTest
A TrueTest is xxxxxxxxx.
Instance Variables
testAND
testInMemory
testNew
testNot
testPrintOn
testXor
UndefinedObjectTest
This is the unit test for the class UndefinedObject. Unit tests are a good way to exercise the functionality of your system in a repeatable and automatic manner. They are therefore recommended if you plan to release anything. For more information, see:
- http://www.c2.com/cgi/wiki?UnitTest
- http://minnow.cc.gatech.edu/squeak/1547
- the sunit class category
testClone
testDeepCopy
testHaltIfNil
testIfNil
testIfNilIfNotNil
testIfNotNil
testIfNotNilDo
testIfNotNilIfNil
testInitializedInstance
testIsEmptyOrNil
testIsLiteral
testIsNil
testNew
testNotNil
testPrintOn
testShallowCopy
testStoreOn
testVeryDeepCopyWith
WeakMessageSendTest
A WeakMessageSendTest is xxxxxxxxx.
Instance Variables
testNoArguments
self run: #testNoArguments
testOneArgument
self run: #testOneArgument
testOneArgumentWithGC
testReceiverWithGC
testTwoArguments
WeekTest
A WeekTest is xxxxxxxxx.
Instance Variables
restoredStartDay: <Object>
week: <Object>
restoredStartDay
- xxxxx
week
- xxxxx
classToBeTested
selectorsToBeIgnored
setUp
June 1998, 5th week
tearDown
testEnumerating
testInquiries
testPreviousNext
YearMonthWeekTest
I am one of several Sunit test Cases intentended to provide complete coverage for the Chronology set of classes as part of the external testing. See DateAndEpochTestCase for a complete list. tlk.
I have no fixtures but do make sure to restore anything I change.
setUp
tearDown
testDaysInMonth
testDaysInYear
testIndexOfDay
testIsLeapYear
testMonthPrintOn
testStartDay
testWeekPrintOn
testYearPrintOn
YearTest
A YearTest is xxxxxxxxx.
Instance Variables
classToBeTested
testCurrent