[squeak-dev] The Trunk: NetworkTests-ul.26.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Nov 9 23:06:31 UTC 2011


Levente Uzonyi uploaded a new version of NetworkTests to project The Trunk:
http://source.squeak.org/trunk/NetworkTests-ul.26.mcz

==================== Summary ====================

Name: NetworkTests-ul.26
Author: ul
Time: 9 November 2011, 11:55:09.007 pm
UUID: e9f5b3a9-2e51-b148-b0ae-45340695e403
Ancestors: NetworkTests-tonyg.25

Added a test for UUID comparisons.

=============== Diff against NetworkTests-tonyg.25 ===============

Item was added:
+ TestCase subclass: #UUIDTest
+ 	instanceVariableNames: ''
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'NetworkTests-UUID'!

Item was added:
+ ----- Method: UUIDTest>>testComparison (in category 'as yet unclassified') -----
+ testComparison
+ 	"Test if the comparison operators define a total sort function."
+ 
+ 	#(
+ 		#[3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0] #[2 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
+ 		#[0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 1] #[0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 4]
+ 		#[2 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0] #[3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
+ 		#[0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 4] #[0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 1]
+ 		#[0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 4] #[0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 4]
+ 	) pairsDo: [ :x :y |
+ 		| a b c d |
+ 		a := UUID newFrom: x.
+ 		b := UUID newFrom: y.
+ 		c := x asString.
+ 		d := y asString.
+ 		"Check if the comparison is lexicographical, just like strings'."
+ 		#(< > <= >= = ~=) do: [ :operation | 
+ 			self assert: (a perform: operation with: b) = (c perform: operation with: d) ].
+ 		"And a few more"
+ 		self
+ 			assert: (a < b) = (a >= b) not;
+ 			assert: (a > b) = (a <= b) not;
+ 			assert: (a = b) = (a ~= b) not;
+ 			assert: (a < b) = (b > a);
+ 			assert: (a > b) = (b < a);
+ 			assert: (a >= b) = (b <= a);
+ 			assert: (a <= b) = (b >= a);
+ 			assert: (a = b) = (b = a);
+ 			assert: (a ~= b) = (b ~= a);
+ 			assert: (a > b) ==> ((a >= b) & (a ~= b));
+ 			assert: (a < b) ==> ((a <= b) & (a ~= b));
+ 			assert: (a >= b) ==> ((a = b) | (a > b));
+ 			assert: (a <= b) ==> ((a = b) | (a < b));
+ 			assert: (a <= b) & (b <= a) ==> (a = b);
+ 			assert: (a >= b) & (b >= a) ==> (a = b);
+ 			assert: (a <= b) | (b <= a);
+ 			assert: (a = b) asBit + (a < b) asBit + (b < a) asBit = 1 ]!




More information about the Squeak-dev mailing list