[squeakdev] The Trunk: NetworkTestsul.27.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Nov 9 23:06:41 UTC 2011
Levente Uzonyi uploaded a new version of NetworkTests to project The Trunk:
http://source.squeak.org/trunk/NetworkTestsul.27.mcz
==================== Summary ====================
Name: NetworkTestsul.27
Author: ul
Time: 10 November 2011, 12:00:11.73 am
UUID: 6bda0a508b7d304ea8407bc9b98c6123
Ancestors: NetworkTestsul.26
Improved UUIDTest >> #testComparison.
=============== Diff against NetworkTestsul.26 ===============
Item was changed:
 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) = ((a < b)  (a > b));
+ assert: (a <= b) & (b <= a) = (a = b);
+ assert: (a >= b) & (b >= a) = (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) ==> ((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 Squeakdev
mailing list
