[Pkg] The Trunk: NetworkTests-ul.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/NetworkTests-ul.27.mcz
==================== Summary ====================
Name: NetworkTests-ul.27
Author: ul
Time: 10 November 2011, 12:00:11.73 am
UUID: 6bda0a50-8b7d-304e-a840-7bc9b98c6123
Ancestors: NetworkTests-ul.26
Improved UUIDTest >> #testComparison.
=============== Diff against NetworkTests-ul.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 Packages
mailing list