blob: 78ab7ac52fac487adabd1d806e7fb2ce8f9dea11 (
plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# **********************************************************************
#
# Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# **********************************************************************
def test(b)
if !b
raise RuntimeError, 'test assertion failed'
end
end
def allTests(helper, communicator)
ref = "test:#{helper.getTestEndpoint()}"
base = communicator.stringToProxy(ref)
test(base)
checksum = Test::ChecksumPrx::checkedCast(base)
test(checksum)
#
# Verify that no checksums are present for local types.
#
print "testing checksums... "
STDOUT.flush
test(Ice::SliceChecksums.length > 0)
for i in Ice::SliceChecksums.keys
test(!i.include?("Local"))
end
#
# Get server's Slice checksums.
#
d = checksum.getSliceChecksums()
#
# Compare the checksums. For a type FooN whose name ends in an integer N,
# we assume that the server's type does not change for N = 1, and does
# change for N > 1.
#
patt = Regexp.new("\\d+")
for i in d.keys
n = 0
m = patt.match(i)
if m
n = i[m.begin(0)...i.length].to_i
end
test(Ice::SliceChecksums.has_key?(i))
if n <= 1
test(Ice::SliceChecksums[i] == d[i])
else
test(Ice::SliceChecksums[i] != d[i])
end
end
puts "ok"
return checksum
end
|