1% 2% Copyright (c) ZeroC, Inc. All rights reserved. 3% 4 5classdef AllTests 6 methods(Static) 7 function allTests(helper) 8 communicator = helper.communicator(); 9 10 fprintf('testing enum... '); 11 12 members = enumeration('classdef_.break_.bitand'); 13 for i = 0:int32(classdef_.break_.bitand.LAST) - 1 14 % Every enumerator should be escaped and therefore have a trailing underscore. 15 name = char(members(i + 1)); 16 assert(strcmp(name(length(name)), '_')); 17 % Ensure ice_getValue is generated correctly. 18 assert(members(i + 1) == classdef_.break_.bitand.ice_getValue(i)); 19 end 20 21 fprintf('ok\n'); 22 23 fprintf('testing struct... '); 24 25 s = classdef_.break_.bitor(); 26 assert(s.case_ == classdef_.break_.bitand.catch_); 27 assert(s.continue_ == 1); 28 assert(s.eq_ == 2); 29 % Exercise the marshaling code. 30 os = communicator.createOutputStream(); 31 classdef_.break_.bitor.ice_write(os, s); 32 is = os.createInputStream(); 33 s2 = classdef_.break_.bitor.ice_read(is); 34 assert(isequal(s, s2)); 35 36 fprintf('ok\n'); 37 38 fprintf('testing class... '); 39 40 c = classdef_.break_.logical(); 41 assert(c.else_ == classdef_.break_.bitand.enumeration_); 42 assert(c.for_.case_ == classdef_.break_.bitand.catch_); 43 assert(c.for_.continue_ == 1); 44 assert(c.for_.eq_ == 2); 45 assert(c.int64 == true); 46 % Exercise the marshaling code. 47 os = communicator.createOutputStream(); 48 os.writeValue(c); 49 os.writePendingValues(); 50 is = os.createInputStream(); 51 v = IceInternal.ValueHolder(); 52 is.readValue(@v.set, 'classdef_.break_.logical'); 53 is.readPendingValues(); 54 assert(v.value.else_ == c.else_); 55 assert(v.value.for_.case_ == c.for_.case_); 56 assert(v.value.for_.continue_ == c.for_.continue_); 57 assert(v.value.for_.eq_ == c.for_.eq_); 58 assert(v.value.int64 == c.int64); 59 60 d = classdef_.break_.xor(); 61 assert(d.else_ == classdef_.break_.bitand.enumeration_); 62 assert(d.for_.case_ == classdef_.break_.bitand.catch_); 63 assert(d.for_.continue_ == 1); 64 assert(d.for_.eq_ == 2); 65 assert(d.int64 == true); 66 assert(d.return_ == 1); 67 % Exercise the marshaling code. 68 os = communicator.createOutputStream(); 69 os.writeValue(d); 70 os.writePendingValues(); 71 is = os.createInputStream(); 72 v = IceInternal.ValueHolder(); 73 is.readValue(@v.set, 'classdef_.break_.xor'); 74 is.readPendingValues(); 75 assert(v.value.else_ == d.else_); 76 assert(v.value.for_.case_ == d.for_.case_); 77 assert(v.value.for_.continue_ == d.for_.continue_); 78 assert(v.value.for_.eq_ == d.for_.eq_); 79 assert(v.value.int64 == d.int64); 80 assert(v.value.return_ == d.return_); 81 82 p = classdef_.break_.properties_(); 83 assert(p.while_ == 1); 84 assert(p.delete == 2); 85 assert(p.if_ == 2); 86 assert(isempty(p.spmd_)); 87 assert(isempty(p.otherwise_)); 88 p.catch_ = d; 89 % Exercise the marshaling code. 90 os = communicator.createOutputStream(); 91 os.writeValue(p); 92 os.writePendingValues(); 93 is = os.createInputStream(); 94 v = IceInternal.ValueHolder(); 95 is.readValue(@v.set, 'classdef_.break_.properties_'); 96 is.readPendingValues(); 97 assert(v.value.while_ == p.while_); 98 assert(v.value.delete == p.delete); 99 assert(v.value.if_ == p.if_); 100 101 fprintf('ok\n'); 102 103 fprintf('testing exception... '); 104 105 e = classdef_.break_.persistent_(); 106 assert(strcmp(e.identifier_, '1')); 107 assert(strcmp(e.message_, '2')); 108 assert(strcmp(e.stack_, '3')); 109 assert(strcmp(e.cause_, '4')); 110 assert(strcmp(e.type_, '5')); 111 assert(isempty(e.end_)); 112 113 g = classdef_.break_.global_(); 114 assert(strcmp(g.identifier_, '1')); 115 assert(strcmp(g.message_, '2')); 116 assert(strcmp(g.stack_, '3')); 117 assert(strcmp(g.cause_, '4')); 118 assert(strcmp(g.type_, '5')); 119 assert(isempty(g.end_)); 120 assert(g.enumeration_ == 1); 121 122 fprintf('ok\n'); 123 124 fprintf('testing interface... '); 125 126 assert(exist('classdef_.break_.elseifPrx', 'class') ~= 0); 127 m = methods('classdef_.break_.elseifPrx'); 128 assert(ismember('events_', m)); 129 assert(ismember('eventsAsync', m)); 130 assert(ismember('function_', m)); 131 assert(ismember('functionAsync', m)); 132 assert(ismember('delete_', m)); 133 assert(ismember('deleteAsync', m)); 134 assert(ismember('checkedCast_', m)); 135 assert(ismember('checkedCastAsync', m)); 136 137 fprintf('ok\n'); 138 139 fprintf('testing constant... '); 140 141 assert(classdef_.break_.methods_.value == 1); 142 143 fprintf('ok\n'); 144 end 145 end 146end 147