@@ -39,136 +39,136 @@ describe('Test CBOR encoding using CloudProtocol v2', () => {
39
39
it ( '[CloudProtocol v2] Generate a valid cbor for a senml string property with basename' , ( ) => {
40
40
const output = '0x81,0xA4,0x61,0x30,0x6B,0x74,0x65,0x73,0x74,0x5F,0x73,0x74,0x72,0x69,0x6E,0x67,0x61,0x33,0x71,0x74,0x65,0x73,0x74,0x5F,0x73,0x74,0x72,0x69,0x6E,0x67,0x20,0x76,0x61,0x6C,0x75,0x65,0x62,0x2D,0x33,0x1A,0x5B,0x98,0xD7,0x80,0x62,0x2D,0x32,0x78,0x2D,0x75,0x72,0x6E,0x3A,0x75,0x75,0x69,0x64,0x3A,0x31,0x66,0x34,0x63,0x65,0x64,0x37,0x30,0x2D,0x35,0x33,0x61,0x64,0x2D,0x34,0x62,0x32,0x39,0x2D,0x62,0x32,0x32,0x31,0x2D,0x31,0x62,0x30,0x61,0x62,0x62,0x64,0x66,0x63,0x37,0x35,0x37,' ;
41
41
const senMl = CBOR . getSenML ( 'test_string' , 'test_string value' , timestamp , true , deviceId ) ;
42
- console . log ( [ senMl ] ) ;
42
+ // console.log([senMl]);
43
43
const cborbase64 = CBOR . toString ( [ senMl ] ) ;
44
- console . log ( cborbase64 ) ;
44
+ // console.log(cborbase64);
45
45
const cborHex = base64toHEX ( cborbase64 ) ;
46
- console . log ( cborHex ) ;
46
+ // console.log(cborHex);
47
47
expect ( cborHex ) . toStrictEqual ( output ) ;
48
48
} ) ;
49
49
50
50
it ( '[CloudProtocol v2] Generate a valid cbor for a senml string property without basename' , ( ) => {
51
51
const output = '0x81,0xA3,0x61,0x30,0x6B,0x74,0x65,0x73,0x74,0x5F,0x73,0x74,0x72,0x69,0x6E,0x67,0x61,0x33,0x71,0x74,0x65,0x73,0x74,0x5F,0x73,0x74,0x72,0x69,0x6E,0x67,0x20,0x76,0x61,0x6C,0x75,0x65,0x62,0x2D,0x33,0x1A,0x5B,0x98,0xD7,0x80,' ;
52
52
const senMl = CBOR . getSenML ( 'test_string' , 'test_string value' , timestamp , true ) ;
53
- console . log ( [ senMl ] ) ;
53
+ // console.log([senMl]);
54
54
const cborbase64 = CBOR . toString ( [ senMl ] ) ;
55
- console . log ( cborbase64 ) ;
55
+ // console.log(cborbase64);
56
56
const cborHex = base64toHEX ( cborbase64 ) ;
57
- console . log ( cborHex ) ;
57
+ // console.log(cborHex);
58
58
expect ( cborHex ) . toStrictEqual ( output ) ;
59
59
} ) ;
60
60
61
61
62
62
it ( '[CloudProtocol v2] Generate a valid cbor for a senml unsigned int property with basename' , ( ) => {
63
63
const output = '0x81,0xA4,0x61,0x30,0x69,0x74,0x65,0x73,0x74,0x5F,0x75,0x69,0x6E,0x74,0x61,0x32,0x03,0x62,0x2D,0x33,0x1A,0x5B,0x98,0xD7,0x80,0x62,0x2D,0x32,0x78,0x2D,0x75,0x72,0x6E,0x3A,0x75,0x75,0x69,0x64,0x3A,0x31,0x66,0x34,0x63,0x65,0x64,0x37,0x30,0x2D,0x35,0x33,0x61,0x64,0x2D,0x34,0x62,0x32,0x39,0x2D,0x62,0x32,0x32,0x31,0x2D,0x31,0x62,0x30,0x61,0x62,0x62,0x64,0x66,0x63,0x37,0x35,0x37,' ;
64
64
const senMl = CBOR . getSenML ( 'test_uint' , 3 , timestamp , true , deviceId ) ;
65
- console . log ( [ senMl ] ) ;
65
+ // console.log([senMl]);
66
66
const cborbase64 = CBOR . toString ( [ senMl ] ) ;
67
- console . log ( cborbase64 ) ;
67
+ // console.log(cborbase64);
68
68
const cborHex = base64toHEX ( cborbase64 ) ;
69
- console . log ( cborHex ) ;
69
+ // console.log(cborHex);
70
70
expect ( cborHex ) . toStrictEqual ( output ) ;
71
71
} ) ;
72
72
73
73
74
74
it ( '[CloudProtocol v2] Generate a valid cbor for a senml unsigned int property without basename' , ( ) => {
75
75
const output = '0x81,0xA3,0x61,0x30,0x69,0x74,0x65,0x73,0x74,0x5F,0x75,0x69,0x6E,0x74,0x61,0x32,0x03,0x62,0x2D,0x33,0x1A,0x5B,0x98,0xD7,0x80,' ;
76
76
const senMl = CBOR . getSenML ( 'test_uint' , 3 , timestamp , true ) ;
77
- console . log ( [ senMl ] ) ;
77
+ // console.log([senMl]);
78
78
const cborbase64 = CBOR . toString ( [ senMl ] ) ;
79
- console . log ( cborbase64 ) ;
79
+ // console.log(cborbase64);
80
80
const cborHex = base64toHEX ( cborbase64 ) ;
81
- console . log ( cborHex ) ;
81
+ // console.log(cborHex);
82
82
expect ( cborHex ) . toStrictEqual ( output ) ;
83
83
} ) ;
84
84
85
85
it ( '[CloudProtocol v2] Generate a valid cbor for a senml signed int property with basename' , ( ) => {
86
86
const output = '0x81,0xA4,0x61,0x30,0x69,0x74,0x65,0x73,0x74,0x5F,0x73,0x69,0x6E,0x74,0x61,0x32,0x22,0x62,0x2D,0x33,0x1A,0x5B,0x98,0xD7,0x80,0x62,0x2D,0x32,0x78,0x2D,0x75,0x72,0x6E,0x3A,0x75,0x75,0x69,0x64,0x3A,0x31,0x66,0x34,0x63,0x65,0x64,0x37,0x30,0x2D,0x35,0x33,0x61,0x64,0x2D,0x34,0x62,0x32,0x39,0x2D,0x62,0x32,0x32,0x31,0x2D,0x31,0x62,0x30,0x61,0x62,0x62,0x64,0x66,0x63,0x37,0x35,0x37,' ;
87
87
const senMl = CBOR . getSenML ( 'test_sint' , - 3 , timestamp , true , deviceId ) ;
88
- console . log ( [ senMl ] ) ;
88
+ // console.log([senMl]);
89
89
const cborbase64 = CBOR . toString ( [ senMl ] ) ;
90
- console . log ( cborbase64 ) ;
90
+ // console.log(cborbase64);
91
91
const cborHex = base64toHEX ( cborbase64 ) ;
92
- console . log ( cborHex ) ;
92
+ // console.log(cborHex);
93
93
expect ( cborHex ) . toStrictEqual ( output ) ;
94
94
} ) ;
95
95
96
96
it ( '[CloudProtocol v2] Generate a valid cbor for a senml signed int property without basename' , ( ) => {
97
97
const output = '0x81,0xA3,0x61,0x30,0x69,0x74,0x65,0x73,0x74,0x5F,0x73,0x69,0x6E,0x74,0x61,0x32,0x22,0x62,0x2D,0x33,0x1A,0x5B,0x98,0xD7,0x80,' ;
98
98
const senMl = CBOR . getSenML ( 'test_sint' , - 3 , timestamp , true ) ;
99
- console . log ( [ senMl ] ) ;
99
+ // console.log([senMl]);
100
100
const cborbase64 = CBOR . toString ( [ senMl ] ) ;
101
- console . log ( cborbase64 ) ;
101
+ // console.log(cborbase64);
102
102
const cborHex = base64toHEX ( cborbase64 ) ;
103
- console . log ( cborHex ) ;
103
+ // console.log(cborHex);
104
104
expect ( cborHex ) . toStrictEqual ( output ) ;
105
105
} ) ;
106
106
107
107
108
108
it ( '[CloudProtocol v2] Generate a valid cbor for a senml float property with basename' , ( ) => {
109
109
const output = '0x81,0xA4,0x61,0x30,0x6A,0x74,0x65,0x73,0x74,0x5F,0x66,0x6C,0x6F,0x61,0x74,0x61,0x32,0xFB,0x40,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x62,0x2D,0x33,0x1A,0x5B,0x98,0xD7,0x80,0x62,0x2D,0x32,0x78,0x2D,0x75,0x72,0x6E,0x3A,0x75,0x75,0x69,0x64,0x3A,0x31,0x66,0x34,0x63,0x65,0x64,0x37,0x30,0x2D,0x35,0x33,0x61,0x64,0x2D,0x34,0x62,0x32,0x39,0x2D,0x62,0x32,0x32,0x31,0x2D,0x31,0x62,0x30,0x61,0x62,0x62,0x64,0x66,0x63,0x37,0x35,0x37,' ;
110
110
const senMl = CBOR . getSenML ( 'test_float' , 3.5 , timestamp , true , deviceId ) ;
111
- console . log ( [ senMl ] ) ;
111
+ // console.log([senMl]);
112
112
const cborbase64 = CBOR . toString ( [ senMl ] ) ;
113
- console . log ( cborbase64 ) ;
113
+ // console.log(cborbase64);
114
114
const cborHex = base64toHEX ( cborbase64 ) ;
115
- console . log ( cborHex ) ;
115
+ // console.log(cborHex);
116
116
expect ( cborHex ) . toStrictEqual ( output ) ;
117
117
} ) ;
118
118
119
119
it ( '[CloudProtocol v2] Generate a valid cbor for a senml float property without basename' , ( ) => {
120
120
const output = '0x81,0xA3,0x61,0x30,0x6A,0x74,0x65,0x73,0x74,0x5F,0x66,0x6C,0x6F,0x61,0x74,0x61,0x32,0xFB,0x40,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x62,0x2D,0x33,0x1A,0x5B,0x98,0xD7,0x80,' ;
121
121
const senMl = CBOR . getSenML ( 'test_float' , 3.5 , timestamp , true ) ;
122
- console . log ( [ senMl ] ) ;
122
+ // console.log([senMl]);
123
123
const cborbase64 = CBOR . toString ( [ senMl ] ) ;
124
- console . log ( cborbase64 ) ;
124
+ // console.log(cborbase64);
125
125
const cborHex = base64toHEX ( cborbase64 ) ;
126
- console . log ( cborHex ) ;
126
+ // console.log(cborHex);
127
127
expect ( cborHex ) . toStrictEqual ( output ) ;
128
128
} ) ;
129
129
130
130
131
131
it ( '[CloudProtocol v2] Generate a valid cbor for a senml double property with basename' , ( ) => {
132
132
const output = '0x81,0xA4,0x61,0x30,0x6B,0x74,0x65,0x73,0x74,0x5F,0x64,0x6F,0x75,0x62,0x6C,0x65,0x61,0x32,0xFB,0x40,0x08,0xFC,0xD6,0xE9,0xBA,0x37,0xB3,0x62,0x2D,0x33,0x1A,0x5B,0x98,0xD7,0x80,0x62,0x2D,0x32,0x78,0x2D,0x75,0x72,0x6E,0x3A,0x75,0x75,0x69,0x64,0x3A,0x31,0x66,0x34,0x63,0x65,0x64,0x37,0x30,0x2D,0x35,0x33,0x61,0x64,0x2D,0x34,0x62,0x32,0x39,0x2D,0x62,0x32,0x32,0x31,0x2D,0x31,0x62,0x30,0x61,0x62,0x62,0x64,0x66,0x63,0x37,0x35,0x37,' ;
133
133
const senMl = CBOR . getSenML ( 'test_double' , 3.1234567890123456 , timestamp , true , deviceId ) ;
134
- console . log ( [ senMl ] ) ;
134
+ // console.log([senMl]);
135
135
const cborbase64 = CBOR . toString ( [ senMl ] ) ;
136
- console . log ( cborbase64 ) ;
136
+ // console.log(cborbase64);
137
137
const cborHex = base64toHEX ( cborbase64 ) ;
138
- console . log ( cborHex ) ;
138
+ // console.log(cborHex);
139
139
expect ( cborHex ) . toStrictEqual ( output ) ;
140
140
} ) ;
141
141
142
142
it ( '[CloudProtocol v2] Generate a valid cbor for a senml double property without basename' , ( ) => {
143
143
const output = '0x81,0xA3,0x61,0x30,0x6B,0x74,0x65,0x73,0x74,0x5F,0x64,0x6F,0x75,0x62,0x6C,0x65,0x61,0x32,0xFB,0x40,0x08,0xFC,0xD6,0xE9,0xBA,0x37,0xB3,0x62,0x2D,0x33,0x1A,0x5B,0x98,0xD7,0x80,' ;
144
144
const senMl = CBOR . getSenML ( 'test_double' , 3.1234567890123456 , timestamp , true ) ;
145
- console . log ( [ senMl ] ) ;
145
+ // console.log([senMl]);
146
146
const cborbase64 = CBOR . toString ( [ senMl ] ) ;
147
- console . log ( cborbase64 ) ;
147
+ // console.log(cborbase64);
148
148
const cborHex = base64toHEX ( cborbase64 ) ;
149
- console . log ( cborHex ) ;
149
+ // console.log(cborHex);
150
150
expect ( cborHex ) . toStrictEqual ( output ) ;
151
151
} ) ;
152
152
153
153
it ( '[CloudProtocol v2] Generate a valid cbor for a senml boolean property with basename' , ( ) => {
154
154
const output = '0x81,0xA4,0x61,0x30,0x69,0x74,0x65,0x73,0x74,0x5F,0x62,0x6F,0x6F,0x6C,0x61,0x34,0xF5,0x62,0x2D,0x33,0x1A,0x5B,0x98,0xD7,0x80,0x62,0x2D,0x32,0x78,0x2D,0x75,0x72,0x6E,0x3A,0x75,0x75,0x69,0x64,0x3A,0x31,0x66,0x34,0x63,0x65,0x64,0x37,0x30,0x2D,0x35,0x33,0x61,0x64,0x2D,0x34,0x62,0x32,0x39,0x2D,0x62,0x32,0x32,0x31,0x2D,0x31,0x62,0x30,0x61,0x62,0x62,0x64,0x66,0x63,0x37,0x35,0x37,' ;
155
155
const senMl = CBOR . getSenML ( 'test_bool' , true , timestamp , true , deviceId ) ;
156
- console . log ( [ senMl ] ) ;
156
+ // console.log([senMl]);
157
157
const cborbase64 = CBOR . toString ( [ senMl ] ) ;
158
- console . log ( cborbase64 ) ;
158
+ // console.log(cborbase64);
159
159
const cborHex = base64toHEX ( cborbase64 ) ;
160
- console . log ( cborHex ) ;
160
+ // console.log(cborHex);
161
161
expect ( cborHex ) . toStrictEqual ( output ) ;
162
162
} ) ;
163
163
164
164
it ( '[CloudProtocol v2] Generate a valid cbor for a senml boolean property without basename' , ( ) => {
165
165
const output = '0x81,0xA3,0x61,0x30,0x69,0x74,0x65,0x73,0x74,0x5F,0x62,0x6F,0x6F,0x6C,0x61,0x34,0xF5,0x62,0x2D,0x33,0x1A,0x5B,0x98,0xD7,0x80,' ;
166
166
const senMl = CBOR . getSenML ( 'test_bool' , true , timestamp , true ) ;
167
- console . log ( [ senMl ] ) ;
167
+ // console.log([senMl]);
168
168
const cborbase64 = CBOR . toString ( [ senMl ] ) ;
169
- console . log ( cborbase64 ) ;
169
+ // console.log(cborbase64);
170
170
const cborHex = base64toHEX ( cborbase64 ) ;
171
- console . log ( cborHex ) ;
171
+ // console.log(cborHex);
172
172
expect ( cborHex ) . toStrictEqual ( output ) ;
173
173
} ) ;
174
174
@@ -182,11 +182,11 @@ describe('Test CBOR encoding using CloudProtocol v2', () => {
182
182
const senMlBool = CBOR . getSenML ( 'test_bool' , true , timestamp , true , deviceId ) ;
183
183
const senMlDouble = CBOR . getSenML ( 'test_double' , 1.79769e+308 , timestamp , true , deviceId ) ;
184
184
const senMl = [ senMlUInt , senMlSInt , senMlFloat , senMlString , senMlBool , senMlDouble ] ;
185
- console . log ( senMl ) ;
185
+ // console.log(senMl);
186
186
const cborbase64 = CBOR . toString ( senMl ) ;
187
- console . log ( cborbase64 ) ;
187
+ // console.log(cborbase64);
188
188
const cborHex = base64toHEX ( cborbase64 ) ;
189
- console . log ( cborHex ) ;
189
+ // console.log(cborHex);
190
190
expect ( cborHex ) . toStrictEqual ( output ) ;
191
191
} ) ;
192
192
@@ -200,11 +200,11 @@ describe('Test CBOR encoding using CloudProtocol v2', () => {
200
200
const senMlBool = CBOR . getSenML ( 'test_bool' , true , timestamp , true ) ;
201
201
const senMlDouble = CBOR . getSenML ( 'test_double' , 1.79769e+308 , timestamp , true ) ;
202
202
const senMl = [ senMlUInt , senMlSInt , senMlFloat , senMlString , senMlBool , senMlDouble ] ;
203
- console . log ( senMl ) ;
203
+ // console.log(senMl);
204
204
const cborbase64 = CBOR . toString ( senMl ) ;
205
- console . log ( cborbase64 ) ;
205
+ // console.log(cborbase64);
206
206
const cborHex = base64toHEX ( cborbase64 ) ;
207
- console . log ( cborHex ) ;
207
+ // console.log(cborHex);
208
208
expect ( cborHex ) . toStrictEqual ( output ) ;
209
209
} ) ;
210
210
} ) ;
0 commit comments