testEncodeDecodeMessage creates a quite complex message for Encode/Decode test
()
| 99 | // testEncodeDecodeMessage creates a quite complex message |
| 100 | // for Encode/Decode test |
| 101 | func testEncodeDecodeMessage() *Message { |
| 102 | m := &Message{ |
| 103 | Version: DefaultVersion, |
| 104 | Code: 0x1234, |
| 105 | RequestID: 0x87654321, |
| 106 | } |
| 107 | |
| 108 | // Populate all groups |
| 109 | m.Operation.Add(MakeAttribute("grp_operation", TagInteger, |
| 110 | Integer(1))) |
| 111 | m.Job.Add(MakeAttribute("grp_job", TagInteger, |
| 112 | Integer(2))) |
| 113 | m.Printer.Add(MakeAttribute("grp_printer", TagInteger, |
| 114 | Integer(3))) |
| 115 | m.Unsupported.Add(MakeAttribute("grp_unsupported", TagInteger, |
| 116 | Integer(4))) |
| 117 | m.Subscription.Add(MakeAttribute("grp_subscription", TagInteger, |
| 118 | Integer(5))) |
| 119 | m.EventNotification.Add(MakeAttribute("grp_eventnotification", TagInteger, |
| 120 | Integer(6))) |
| 121 | m.Resource.Add(MakeAttribute("grp_resource", TagInteger, |
| 122 | Integer(7))) |
| 123 | m.Document.Add(MakeAttribute("grp_document", TagInteger, |
| 124 | Integer(8))) |
| 125 | m.System.Add(MakeAttribute("grp_system", TagInteger, |
| 126 | Integer(9))) |
| 127 | m.Future11.Add(MakeAttribute("grp_future11", TagInteger, |
| 128 | Integer(10))) |
| 129 | m.Future12.Add(MakeAttribute("grp_future12", TagInteger, |
| 130 | Integer(11))) |
| 131 | m.Future13.Add(MakeAttribute("grp_future13", TagInteger, |
| 132 | Integer(12))) |
| 133 | m.Future14.Add(MakeAttribute("grp_future14", TagInteger, |
| 134 | Integer(13))) |
| 135 | m.Future15.Add(MakeAttribute("grp_future15", TagInteger, |
| 136 | Integer(14))) |
| 137 | |
| 138 | // Use all possible attribute types |
| 139 | m.Operation.Add(MakeAttribute("type_integer", TagInteger, Integer(123))) |
| 140 | |
| 141 | m.Operation.Add(MakeAttribute("type_boolean_t", TagBoolean, Boolean(true))) |
| 142 | m.Operation.Add(MakeAttribute("type_boolean_f", TagBoolean, Boolean(false))) |
| 143 | |
| 144 | m.Operation.Add(MakeAttribute("type_void", TagUnsupportedValue, Void{})) |
| 145 | |
| 146 | m.Operation.Add(MakeAttribute("type_string_1", TagText, String("hello"))) |
| 147 | m.Operation.Add(MakeAttribute("type_string_2", TagText, String(""))) |
| 148 | |
| 149 | m.Operation.Add(MakeAttribute("type_time_1", TagDateTime, |
| 150 | parseTime("01/02 03:04:05PM '06 -0700"))) |
| 151 | m.Operation.Add(MakeAttribute("type_time_2", TagDateTime, |
| 152 | parseTime("01/02 03:04:05PM '06 +0700"))) |
| 153 | m.Operation.Add(MakeAttribute("type_time_3", TagDateTime, |
| 154 | parseTime("01/02 03:04:05PM '06 -0730"))) |
| 155 | |
| 156 | m.Operation.Add(MakeAttribute("type_resolution_1", TagResolution, |
| 157 | Resolution{123, 456, UnitsDpi})) |
| 158 | m.Operation.Add(MakeAttribute("type_resolution_2", TagResolution, |
no test coverage detected