| 127 | |
| 128 | template<typename Type> |
| 129 | bool run_test_i(Encoding::Kind e) |
| 130 | { |
| 131 | Type src; |
| 132 | src.a.s = "hello"; |
| 133 | src.a.l = 42; |
| 134 | src.a.w = L'\x263a'; |
| 135 | src.a.c = 'j'; |
| 136 | src.sa[0] = 23; |
| 137 | src.sa[1] = -16536; |
| 138 | src.sa[2] = 16535; |
| 139 | fill_2d(src.asa); |
| 140 | src.ss.length(2); |
| 141 | src.ss[0].s = "seq elt 0"; |
| 142 | src.ss[0].l = 9; |
| 143 | src.ss[1].s = "seq elt 1"; |
| 144 | src.ss[1].l = -27; |
| 145 | src.e = other1; |
| 146 | src.u.u_f(2.17f); |
| 147 | src.mu.u_f(2.17f); |
| 148 | src.anon_seq.length(2); |
| 149 | src.anon_seq[0].s = "seq elt 0"; |
| 150 | src.anon_seq[0].l = 9; |
| 151 | src.anon_seq[1].s = "seq elt 1"; |
| 152 | src.anon_seq[1].l = -27; |
| 153 | src.stra[0] = "hello"; |
| 154 | src.stra[1] = "world!"; |
| 155 | src.stra[2] = "goodbye"; |
| 156 | src.astra[0] = "hello"; |
| 157 | src.astra[1] = "world!"; |
| 158 | src.astra[2] = "goodbye"; |
| 159 | src.s = "hello"; |
| 160 | |
| 161 | const MetaStruct& meta = getMetaStruct<Type>(); |
| 162 | |
| 163 | Type tgt; |
| 164 | for (const char** fields = meta.getFieldNames(); *fields; ++fields) { |
| 165 | meta.assign(&tgt, *fields, &src, *fields, meta); |
| 166 | } |
| 167 | const Encoding encoding(e); |
| 168 | Message_Block_Ptr data(new ACE_Message_Block(serialized_size(encoding, src))); |
| 169 | Serializer ser(data.get(), encoding); |
| 170 | if (!(ser << src)) { |
| 171 | std::cout << "ERROR: Failed to serialize source" << std::endl; |
| 172 | return false; |
| 173 | } |
| 174 | // Use checkVal for types that aren't supported in MetaStruct::getValue(), such as arrays and unions |
| 175 | return |
| 176 | check(tgt.a.s.inout(), src.a.s.inout(), "a.s", data.get(), Value::VAL_STRING, meta, &Value::s_, e) |
| 177 | && check(tgt.a.l, src.a.l, "a.l", data.get(), Value::VAL_INT, meta, &Value::i_, e) |
| 178 | && check(tgt.a.w, src.a.w, "a.w", data.get(), Value::VAL_INT, meta, &Value::i_, e) |
| 179 | && check(tgt.a.c, src.a.c, "a.c", data.get(), Value::VAL_CHAR, meta, &Value::c_, e) |
| 180 | && checkVal(tgt.sa[0], src.sa[0], "sa[0]") |
| 181 | && checkVal(tgt.sa[1], src.sa[1], "sa[1]") |
| 182 | && checkVal(tgt.sa[2], src.sa[2], "sa[2]") |
| 183 | && check_array(tgt.asa, src.asa, "asa") |
| 184 | && checkVal(tgt.ss.length(), src.ss.length(), "ss.length()") |
| 185 | && checkVal(tgt.ss[0].s, src.ss[0].s, "ss[0].s") |
| 186 | && checkVal(tgt.ss[0].l, src.ss[0].l, "ss[0].l") |
nothing calls this directly
no test coverage detected