src/base/chunk_generator.test.cc
/*
 * A test to ensure a non-zero start functions correctly.
 */
A test to ensure a non-zero start functions correctly.
A test to ensure a non - zero start functions correctly .
TEST(ChunkGeneratorTest, StartAtNonZero)
{
    ChunkGenerator chunk_generator(4, 32, 8); 
    EXPECT_EQ(4, chunk_generator.addr());
    EXPECT_EQ(4, chunk_generator.size());
    EXPECT_EQ(0, chunk_generator.complete());
    EXPECT_FALSE(chunk_generator.done());
    EXPECT_FALSE(chunk_generator.last());
    EXPECT_TRUE(chunk_generator.next());
    EXPECT_EQ(8, chunk_generator.addr());
    EXPECT_EQ(8, chunk_generator.size());
    EXPECT_EQ(4, chunk_generator.complete());
    EXPECT_FALSE(chunk_generator.done());
    EXPECT_FALSE(chunk_generator.last());
    EXPECT_TRUE(chunk_generator.next());
    EXPECT_EQ(16, chunk_generator.addr());
    EXPECT_EQ(8, chunk_generator.size());
    EXPECT_EQ(12, chunk_generator.complete());
    EXPECT_FALSE(chunk_generator.done());
    EXPECT_FALSE(chunk_generator.last());
    EXPECT_TRUE(chunk_generator.next());
    EXPECT_EQ(24, chunk_generator.addr());
    EXPECT_EQ(8, chunk_generator.size());
    EXPECT_EQ(20, chunk_generator.complete());
    EXPECT_FALSE(chunk_generator.done());
    EXPECT_FALSE(chunk_generator.last());
    EXPECT_TRUE(chunk_generator.next());
    EXPECT_EQ(32, chunk_generator.addr());
    EXPECT_EQ(4, chunk_generator.size());
    EXPECT_EQ(28, chunk_generator.complete());
    EXPECT_FALSE(chunk_generator.done());
    EXPECT_TRUE(chunk_generator.last());
    EXPECT_FALSE(chunk_generator.next());
    EXPECT_EQ(32, chunk_generator.addr());
    EXPECT_EQ(0, chunk_generator.size());
    EXPECT_EQ(28, chunk_generator.complete());
    EXPECT_TRUE(chunk_generator.done());
    EXPECT_TRUE(chunk_generator.last());
}
TEST ( ChunkGeneratorTest , StartAtNonZero ) { ChunkGenerator chunk_generator ( 4 , 32 , 8 ) ; EXPECT_EQ ( 4 , chunk_generator . addr ( ) ) ; EXPECT_EQ ( 4 , chunk_generator . size ( ) ) ; EXPECT_EQ ( 0 , chunk_generator . complete ( ) ) ; EXPECT_FALSE ( chunk_generator . done ( ) ) ; EXPECT_FALSE ( chunk_generator . last ( ) ) ; EXPECT_TRUE ( chunk_generator . next ( ) ) ; EXPECT_EQ ( 8 , chunk_generator . addr ( ) ) ; EXPECT_EQ ( 8 , chunk_generator . size ( ) ) ; EXPECT_EQ ( 4 , chunk_generator . complete ( ) ) ; EXPECT_FALSE ( chunk_generator . done ( ) ) ; EXPECT_FALSE ( chunk_generator . last ( ) ) ; EXPECT_TRUE ( chunk_generator . next ( ) ) ; EXPECT_EQ ( 16 , chunk_generator . addr ( ) ) ; EXPECT_EQ ( 8 , chunk_generator . size ( ) ) ; EXPECT_EQ ( 12 , chunk_generator . complete ( ) ) ; EXPECT_FALSE ( chunk_generator . done ( ) ) ; EXPECT_FALSE ( chunk_generator . last ( ) ) ; EXPECT_TRUE ( chunk_generator . next ( ) ) ; EXPECT_EQ ( 24 , chunk_generator . addr ( ) ) ; EXPECT_EQ ( 8 , chunk_generator . size ( ) ) ; EXPECT_EQ ( 20 , chunk_generator . complete ( ) ) ; EXPECT_FALSE ( chunk_generator . done ( ) ) ; EXPECT_FALSE ( chunk_generator . last ( ) ) ; EXPECT_TRUE ( chunk_generator . next ( ) ) ; EXPECT_EQ ( 32 , chunk_generator . addr ( ) ) ; EXPECT_EQ ( 4 , chunk_generator . size ( ) ) ; EXPECT_EQ ( 28 , chunk_generator . complete ( ) ) ; EXPECT_FALSE ( chunk_generator . done ( ) ) ; EXPECT_TRUE ( chunk_generator . last ( ) ) ; EXPECT_FALSE ( chunk_generator . next ( ) ) ; EXPECT_EQ ( 32 , chunk_generator . addr ( ) ) ; EXPECT_EQ ( 0 , chunk_generator . size ( ) ) ; EXPECT_EQ ( 28 , chunk_generator . complete ( ) ) ; EXPECT_TRUE ( chunk_generator . done ( ) ) ; EXPECT_TRUE ( chunk_generator . last ( ) ) ; }
A test to ensure a non-zero start functions correctly.
A test to ensure a non - zero start functions correctly .
//End address: 36. /*
     * As the starting position is 4, moving to the next bit should move to
     * 8 (i.e., process the remainder of the first chunk in the region).
     */ // Process the rest of the region. // The last chunk is also only 4 bytes.