Skip to content

Commit

Permalink
Added tests by J. LONG (TAMU)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntarabelloni committed Jul 6, 2016
1 parent 3971bb1 commit 461b664
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/testthat/test_EI_and_MEI.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,22 @@ test_that( "Correctness of EI",

test_that( "Correctness of MEI",
expect_equal( MEI( Data ), rep( 1 - ( N - 1 ) / N^2, N ) ) )



# TEST BY JAMES LONG (TAMU) -------------------------------------------------------------------

yints = c( 1.27, .927, 1/2, .217, 0)
slopes = c( -1, -1, 0, 1, 1 )
time_grid = ( 0 : 100 ) / 100

Data = matrix( 0, nrow = length( yints ),
ncol = length( time_grid ) )

for( i in 1 : length( yints ) )

Data[ i, ] = yints[ i ] + time_grid * slopes[ i ]

test_that( "Correctness of EI - James Long test",
expect_equal( EI( Data ), c( 0.2, 0.4, 0.2, 0.2, 0.4 ) ) )

18 changes: 18 additions & 0 deletions tests/testthat/test_HI_and_MHI.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,21 @@ test_that( "Correctness of HI",

test_that( "Correctness of MHI",
expect_equal( MHI( Data ), rep( ( N + ( N - 1 )^2 ) / N^2 , N ) ) )


# TEST BY JAMES LONG (TAMU) -------------------------------------------------------------------

yints = c( 1.27, .927, 1/2, .217, 0)
slopes = c( -1, -1, 0, 1, 1 )
time_grid = ( 0 : 100 ) / 100

Data = matrix( 0, nrow = length( yints ),
ncol = length( time_grid ) )

for( i in 1 : length( yints ) )

Data[ i, ] = yints[ i ] + time_grid * slopes[ i ]

test_that( "Correctness of HI - James Long test",
expect_equal( HI( Data ), c( 0.4, 0.2, 0.2, 0.4, 0.2 ) ) )

19 changes: 19 additions & 0 deletions tests/testthat/test_HRD_and_MHRD.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,22 @@ test_that( "Correctness of HRD",

test_that( "Correctness of MHRD",
expect_equal( MHRD( D ), mapply( min, id_vector / N, ( N - id_vector + 1 ) / N ) ) )


# TEST BY JAMES LONG (TAMU) -------------------------------------------------------------------

yints = c( 1.27, .927, 1/2, .217, 0)
slopes = c( -1, -1, 0, 1, 1 )
time_grid = ( 0 : 100 ) / 100

Data = matrix( 0, nrow = length( yints ),
ncol = length( time_grid ) )

for( i in 1 : length( yints ) )

Data[ i, ] = yints[ i ] + time_grid * slopes[ i ]

test_that( "Correctness of HRD - James Long test",
expect_equal( HRD( Data ), rep( 0.2, 5 ) ) )


0 comments on commit 461b664

Please sign in to comment.