2014-11-28 18:38:24 +01:00
# include "testutils/FuseUtimensTest.h"
using : : testing : : StrEq ;
using : : testing : : Return ;
using : : testing : : WithParamInterface ;
using : : testing : : Values ;
class FuseUtimensTimeParameterTest : public FuseUtimensTest , public WithParamInterface < const timespec * > {
} ;
const timespec TIMEVAL1 [ 2 ] = { FuseUtimensTest : : makeTimespec ( 0 , 0 ) , FuseUtimensTest : : makeTimespec ( 0 , 0 ) } ;
const timespec TIMEVAL2 [ 2 ] = { FuseUtimensTest : : makeTimespec ( 1000 , 0 ) , FuseUtimensTest : : makeTimespec ( 0 , 0 ) } ;
const timespec TIMEVAL3 [ 2 ] = { FuseUtimensTest : : makeTimespec ( 0 , 1000 ) , FuseUtimensTest : : makeTimespec ( 0 , 0 ) } ;
const timespec TIMEVAL4 [ 2 ] = { FuseUtimensTest : : makeTimespec ( 1000 , 1000 ) , FuseUtimensTest : : makeTimespec ( 0 , 0 ) } ;
const timespec TIMEVAL5 [ 2 ] = { FuseUtimensTest : : makeTimespec ( 0 , 0 ) , FuseUtimensTest : : makeTimespec ( 0 , 0 ) } ;
const timespec TIMEVAL6 [ 2 ] = { FuseUtimensTest : : makeTimespec ( 0 , 0 ) , FuseUtimensTest : : makeTimespec ( 1000 , 0 ) } ;
const timespec TIMEVAL7 [ 2 ] = { FuseUtimensTest : : makeTimespec ( 0 , 0 ) , FuseUtimensTest : : makeTimespec ( 0 , 1000 ) } ;
const timespec TIMEVAL8 [ 2 ] = { FuseUtimensTest : : makeTimespec ( 0 , 0 ) , FuseUtimensTest : : makeTimespec ( 1000 , 1000 ) } ;
const timespec TIMEVAL9 [ 2 ] = { FuseUtimensTest : : makeTimespec ( 1417196126 , 123000 ) , FuseUtimensTest : : makeTimespec ( 1417109713 , 321000 ) } ; // current timestamp and the day before as of writing this test case
2015-12-14 19:26:19 +01:00
const timespec TIMEVAL10 [ 2 ] = { FuseUtimensTest : : makeTimespec ( UINT64_C ( 1024 ) * 1024 * 1024 * 1024 , 999000 ) , FuseUtimensTest : : makeTimespec ( UINT64_C ( 2 * 1024 ) * 1024 * 1024 * 1024 , 321000 ) } ; // needs 64bit for timestamp representation
2014-11-28 18:38:24 +01:00
INSTANTIATE_TEST_CASE_P ( FuseUtimensTimeParameterTest , FuseUtimensTimeParameterTest ,
Values ( TIMEVAL1 , TIMEVAL2 , TIMEVAL3 , TIMEVAL4 , TIMEVAL5 , TIMEVAL6 , TIMEVAL7 , TIMEVAL8 , TIMEVAL9 , TIMEVAL10 ) ) ;
TEST_P ( FuseUtimensTimeParameterTest , Utimens ) {
ReturnIsFileOnLstat ( FILENAME ) ;
2018-12-03 07:57:21 +01:00
EXPECT_CALL ( * fsimpl , utimens ( StrEq ( FILENAME ) , TimeSpecEq ( GetParam ( ) [ 0 ] ) , TimeSpecEq ( GetParam ( ) [ 1 ] ) ) )
2014-11-28 18:38:24 +01:00
. Times ( 1 ) . WillOnce ( Return ( ) ) ;
2016-02-09 09:36:07 +01:00
Utimens ( FILENAME , GetParam ( ) [ 0 ] , GetParam ( ) [ 1 ] ) ;
2014-11-28 18:38:24 +01:00
}