EMMA Coverage Report (generated Tue Dec 18 20:38:46 CET 2007)
[all classes][cz.vutbr.feec.packets.rtcp]

## COVERAGE SUMMARY FOR SOURCE FILE [SDESChunkTest.java]

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
SDESChunkTest.java | 100% (1/1) | 100% (4/4) | 98% (139/142) | 100% (32,9/33)

### COVERAGE BREAKDOWN BY CLASS AND METHOD

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
class SDESChunkTest | 100% (1/1) | 100% (4/4) | 98% (139/142) | 100% (32,9/33)
testSDESChunk (int): void |  | 100% (1/1) | 96% (55/57) | 99% (12,9/13)
testSDESItem (int, String): void |  | 100% (1/1) | 97% (37/38) | 100% (9/9)
SDESChunkTest (): void |  | 100% (1/1) | 100% (7/7) | 100% (2/2)
testSDESPacket (): void |  | 100% (1/1) | 100% (40/40) | 100% (9/9)

1 | package cz.vutbr.feec.packets.rtcp;
2 |
3 | import org.junit.Assert;
4 | import org.junit.Test;
5 |
6 | import cz.vutbr.feec.packets.PacketGenerateException;
7 | import cz.vutbr.feec.packets.PacketParseException;
8 |
9 | public class SDESChunkTest {
10 |
11 | byte[] buffer = new byte[500];
12 |
13 | @Test
14 | public void testSDESPacket() throws PacketGenerateException,
15 | PacketParseException {
16 | for (int i = 0; i < 30; i++) {
17 | String s = "";
18 | for (int j = 0; j < i; j++) {
19 | s += "x";
20 | }
21 | testSDESItem(0, s);
22 | testSDESItem(5, s);
23 | }
24 |
25 | testSDESChunk(0);
26 | testSDESChunk(5);
27 | }
28 |
29 | public void testSDESItem(int offset, String text) throws PacketGenerateException,
30 | PacketParseException {
31 | SDESItem orig = new SDESItem();
32 | orig.setText(text);
33 | orig.setType(SDESItem.NAME);
34 |
35 | int len1 = orig.generate(buffer, offset);
36 |
37 | SDESItem pars = new SDESItem();
38 | int len2 = pars.parse(buffer, offset, len1);
39 |
40 | Assert.assertTrue(len1 == len2);
41 | Assert.assertEquals(orig, pars);
42 | }
43 |
44 | public void testSDESChunk(int offset) throws PacketGenerateException,
45 | PacketParseException {
46 |
47 | SDESChunk orig = new SDESChunk();
48 | orig.setSSRC_CSRC(16843009);
49 |
50 | SDESItem item13 = new SDESItem();
51 |
52 | // item11.setText("Crewllll");
53 | // item11.setType(SDESItem.NAME);
54 | //
55 | // item12.setType(SDESItem.NAME);
56 | // item12.setText("Jakub Müller");
57 |
58 | item13.setType(SDESItem.EMAIL);
59 | // item13.setText("mullerjakub@centrum.cz");
60 | // item13.setText("xxxxxxxxxxxxxxxxxxxxxx");
61 | item13.setText("xxx");
62 |
63 | // konec bude vkladan automaticky pri parse a generate
64 | // item14.setType(SDESItem.END);
65 | // item14.setText("");
66 |
67 | // orig.addItem(item11);
68 | // orig.addItem(item12);
69 | orig.addItem(item13);
70 |
71 | int len1 = orig.generate(buffer, offset);
72 |
73 | SDESChunk pars = new SDESChunk();
74 | int len2 = pars.parse(buffer, offset, len1);
75 |
76 | Assert.assertTrue(len1 == len2);
77 | Assert.assertTrue("Musi byt zarovnano na 4 byty", len1 % 4 == 0);
78 |
79 | Assert.assertEquals(orig, pars);
80 | }
81 |
82 | }

[all classes][cz.vutbr.feec.packets.rtcp]
EMMA 2.0.5312 EclEmma Fix 1 (C) Vladimir Roubtsov