xml

Javascript code posted
created at 18 Sep 04:46, updated at 20 Sep 17:53

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
describe("Test data aggregation within D2DMetricsDataStream", function () {
    //Configuration
    var T_SAMPLE_POINT = 5;
  
    //local variables
    var myInstance;
  
    beforeEach( function () {
        //Set Up
        //Create a new instance of our controller-under-test
        myInstance = new D2DMetricsDataStream( {  timestampColIndex : 0
                                                 ,dataColIndex      : 1
                                                 ,samplePoint       : T_SAMPLE_POINT } );
    } );
  
    afterEach( function () {
        //Tear Down
        myInstance = null;
    } );
  
    it ("Aggregates simple data correctly", function () {
        var testInputArray = [ [15,5], [6,15], [5,10], [1,5], [0,10], [0,5] ];
        var testInputTimestamp = 15;
        var expectedOutcome = [ [15,5,1], [10,0,0], [5,25,2], [0,20,3] ];
    
        var result = myInstance.aggregatePointArray( testInput, testInputTimestamp );
    
        expect( result ).toEqual( expectedOutcome );
    } );
} );
1.02 KB in 3 ms with coderay