Jacob Erlbeck | 7cd8a1b | 2015-11-27 13:26:16 +0100 | [diff] [blame] | 1 | Testing the msgb API |
| 2 | Buffer: |
| 3 | put(4) -> data+0 |
| 4 | Buffer: [L1]> 00 00 00 00 |
| 5 | put(4) -> data+4 |
| 6 | Buffer: [L1]> 00 00 00 00 [L2]> 00 00 00 00 |
| 7 | put(4) -> data+8 |
| 8 | Buffer: [L1]> 00 00 00 00 [L2]> 00 00 00 00 [L3]> 00 00 00 00 |
| 9 | put(4) -> data+12 |
| 10 | Buffer: [L1]> 00 00 00 00 [L2]> 00 00 00 00 [L3]> 00 00 00 00 [L4]> 00 00 00 00 |
| 11 | push(4) -> data+0 |
| 12 | Buffer: 00 00 00 00 [L1]> 00 00 00 00 [L2]> 00 00 00 00 [L3]> 00 00 00 00 [L4]> 00 00 00 00 |
| 13 | trim(16) -> 0 |
| 14 | Buffer: 00 00 00 00 [L1]> 00 00 00 00 [L2]> 00 00 00 00 [L3]> 00 00 00 00 [L4]> |
| 15 | get(4) -> data+12 |
| 16 | Buffer: 00 00 00 00 [L1]> 00 00 00 00 [L2]> 00 00 00 00 [L3]> (L4=tail+4) |
| 17 | Test msgb_hexdump |
| 18 | Buffer: (L1=data-124) 00 00 00 00 00 00 00 00 [L2]> 00 00 00 00 [L3]> (L4=tail+4) |
| 19 | Buffer: (L1=data-124) 00 00 00 00 00 00 00 00 [L2]> (L3+8) 00 00 00 00 (L4=tail+4) |
| 20 | Buffer: (L1=data-124) 00 00 00 00 00 00 00 00 [L2]> 00 00 00 00 (L3 out of range) (L4=tail+4) |
Jacob Erlbeck | 17b3c3a | 2015-11-27 13:26:20 +0100 | [diff] [blame] | 21 | Testing the msgb API error handling |
| 22 | msgb(%p): Negative length is not allowed |
Jacob Erlbeck | 0a053ec | 2015-11-27 13:26:18 +0100 | [diff] [blame] | 23 | Testing msgb_copy |
| 24 | Src: [L1]> 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 [L2]> 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 [L3]> 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b [L4]> 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |
| 25 | Dst: [L1]> 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 [L2]> 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 [L3]> 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b [L4]> 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |
| 26 | msgb(%p): Sub area is not fully contained in the msg data |
| 27 | msgb(%p): Sub area is not fully contained in the msg data |
| 28 | msgb(%p): Sub area is not fully contained in the msg data |
| 29 | msgb(%p): Negative sizes are not allowed |
| 30 | msgb(%p): Negative sizes are not allowed |
| 31 | Testing msgb_resize_area |
| 32 | Original: [L1]> 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 [L2]> 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 [L3]> 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b [L4]> 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |
| 33 | Extended: [L1]> 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 [L2]> 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [L3]> 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b [L4]> 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |
| 34 | Shrinked: [L1]> 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 [L2]> 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [L3]> 28 29 2a 2b 2c 2d 2e 2f 30 31 [L4]> 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |
Philipp Maier | c5b47cc | 2017-10-10 16:53:21 +0200 | [diff] [blame] | 35 | Add normal text: |
| 36 | #1: rc=0, total_len=47, msg->data=|this is a test 4711, testme, 4711| |
| 37 | #2: rc=0, total_len=63, msg->data=|this is a test 4711, testme, 4711||some more text| |
| 38 | #3: rc=-22, total_len=63, msg->data=|this is a test 4711, testme, 4711||some more text||more 23 fee tex |
| 39 | #4: rc=-22, total_len=63, msg->data=|this is a test 4711, testme, 4711||some more text||more 123456 ABC |
| 40 | #5: rc=0, total_len=79, msg->data=|this is a test 4711, testme, 4711||some more text||more 123456 AB| |
| 41 | #6: rc=0, total_len=79, msg->data=|this is a test 4711, testme, 4711||some more text||more 123456 AB| |
| 42 | #7: before: 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 after: rc=-22, 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 ==> ok, no change |
Jacob Erlbeck | 7cd8a1b | 2015-11-27 13:26:16 +0100 | [diff] [blame] | 43 | Success. |