EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.sensorframework.storage.tests]

COVERAGE SUMMARY FOR SOURCE FILE [DoubleListTest.java]

nameclass, %method, %block, %line, %
DoubleListTest.java100% (1/1)100% (3/3)93%  (135/145)83%  (30/36)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DoubleListTest100% (1/1)100% (3/3)93%  (135/145)83%  (30/36)
testList (): void 100% (1/1)93%  (66/71)84%  (16/19)
testList2 (): void 100% (1/1)93%  (66/71)81%  (13/16)
DoubleListTest (): void 100% (1/1)100% (3/3)100% (1/1)

1package de.uka.ipd.sdq.sensorframework.storage.tests;
2 
3import java.io.File;
4import java.io.IOException;
5 
6import junit.framework.Assert;
7import junit.framework.TestCase;
8import de.uka.ipd.sdq.sensorframework.storage.lists.BackgroundMemoryList;
9import de.uka.ipd.sdq.sensorframework.storage.lists.DoubleSerialiser;
10 
11 
12public class DoubleListTest extends TestCase {
13 
14        private static final int LARGE_LIST_TEST_COUNT = 1000000;
15 
16        public void testList() {
17                BackgroundMemoryList<Double> list;
18                try {
19                        File tempFile = File.createTempFile("TempDB", "lst");
20                        list = new BackgroundMemoryList<Double>(tempFile.getAbsolutePath(),
21                                        new DoubleSerialiser());
22                        list.add(1.0);
23                        list.close();
24                        Assert.assertEquals(8, tempFile.length());
25                        
26                        list = new BackgroundMemoryList<Double>(tempFile.getAbsolutePath(),
27                                        new DoubleSerialiser());
28                        Assert.assertEquals(1,list.size());
29                        Assert.assertEquals(1.0, list.get(0));
30                        list.add(2.0);
31                        Assert.assertEquals(2,list.size());
32                        Assert.assertEquals(2.0, list.get(1));
33                        list.close();
34                        Assert.assertEquals(16, tempFile.length());
35                        
36                } catch (IOException e) {
37                        e.printStackTrace();
38                        Assert.assertTrue(false);
39                }
40        }
41 
42        public void testList2() {
43                BackgroundMemoryList<Double> list;
44                try {
45                        File tempFile = File.createTempFile("TempDB", "lst");
46                        list = new BackgroundMemoryList<Double>(tempFile.getAbsolutePath(),
47                                        new DoubleSerialiser());
48                        for (double i = 0; i < LARGE_LIST_TEST_COUNT; i += 1)
49                                list.add(i);
50                        list.close();
51                        Assert.assertEquals(LARGE_LIST_TEST_COUNT * 8, tempFile.length());
52                        
53                        list = new BackgroundMemoryList<Double>(tempFile.getAbsolutePath(),
54                                        new DoubleSerialiser());
55                        for (double i = 0; i < LARGE_LIST_TEST_COUNT; i += 1)
56                                Assert.assertEquals(i,list.get((int)i));
57                        list.close();
58                } catch (IOException e) {
59                        e.printStackTrace();
60                        Assert.assertTrue(false);
61                }
62        }
63        
64}

[all classes][de.uka.ipd.sdq.sensorframework.storage.tests]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov