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

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

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
GenericBlockTest.java | 100% (1/1) | 100% (3/3) | 96% (180/187) | 99% (41,6/42)

### COVERAGE BREAKDOWN BY CLASS AND METHOD

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
class GenericBlockTest | 100% (1/1) | 100% (3/3) | 96% (180/187) | 99% (41,6/42)
test1 (int, GenericBlock): void |  | 100% (1/1) | 94% (108/115) | 98% (22,6/23)
GenericBlockTest (): void |  | 100% (1/1) | 100% (7/7) | 100% (2/2)
testAll (): void |  | 100% (1/1) | 100% (65/65) | 100% (17/17)

1 | package cz.vutbr.feec.packets.rsi;
2 |
3 | import junit.framework.Assert;
4 |
5 | import org.junit.Test;
6 |
7 | import cz.vutbr.feec.packets.PacketException;
8 | import cz.vutbr.feec.packets.rsi.GenericBlock;
9 | import cz.vutbr.feec.packets.rsi.GenericBlockJitter;
10 |
11 | public class GenericBlockTest {
12 | byte[] buf = new byte[100];
13 | // generate
14 | // read
15 | public void test1(int offset, GenericBlock g ) throws PacketException {
16 | g.setMultiplicativeFactor(1<<3);
17 | g.setMaximumDistributionValue(1L << 31);
18 | g.setMinimumDistributionValue(1L << 31);
19 | g.addBucket(1);
20 | Assert.assertTrue(g.getNumberOfDistributionBuckets() == 1);
21 | g.addBucket(2);
22 | g.addBucket(3);
23 | g.addBucket(4);
24 | g.addBucket(5);
25 | g.addBucket(6);
26 | g.addBucket(7);
27 | g.addBucket(8);
28 | Assert.assertTrue(g.getNumberOfDistributionBuckets() == 8);
29 | int pktLen = g.generate(buf, 0);
30 |
31 | GenericBlock r = new GenericBlockJitter();
32 | int res = r.parse(buf, 0, pktLen);
33 | res = r.parse(buf, 0, pktLen);
34 | Assert.assertTrue(res == pktLen);
35 | Assert.assertTrue(r.getMaximumDistributionValue() == 1 << 31);
36 | Assert.assertTrue(r.getMinimumDistributionValue() == 1 << 31);
37 | Assert.assertTrue(r.getMultiplicativeFactor() == 1 <<3);
38 | Assert.assertTrue(r.getNumberOfDistributionBuckets() == 8);
39 | }
40 |
41 |
42 | @Test
43 | public void testAll() throws PacketException {
44 | GenericBlock g = new GenericBlockJitter();
45 | test1(0, g);
46 | g = new GenericBlockJitter();
47 | test1(5, g);
48 | g = new GenericBlockCummuLoss();
49 | test1(0, g);
50 | g = new GenericBlockCummuLoss();
51 | test1(5, g);
52 | g = new GenericBlockRtt();
53 | test1(0, g);
54 | g = new GenericBlockRtt();
55 | test1(5, g);
56 | g = new GenericBlockLoss();
57 | test1(0, g);
58 | g = new GenericBlockLoss();
59 | test1(5, g);
60 | }
61 | }

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