@@ -714,11 +714,11 @@ TEST(kvs_snapshot_rotate, snapshot_rotate_success)
714714 ASSERT_TRUE (result);
715715
716716 /* Create empty Test-Snapshot Files */
717- for (size_t i = 1 ; i < KVS_MAX_SNAPSHOTS; i++)
717+ for (size_t i = 0 ; i < KVS_MAX_SNAPSHOTS; i++)
718718 {
719719 std::ofstream (filename_prefix + " _" + std::to_string (i) + " .json" ) << " {}" ;
720720 std::ofstream (filename_prefix + " _" + std::to_string (i) + " .hash" ) << " {}" ;
721- EXPECT_EQ (result.value ().snapshot_count ().value (), i);
721+ EXPECT_EQ (result.value ().snapshot_count ().value (), i+ 1 );
722722 }
723723 ASSERT_FALSE (std::filesystem::exists (filename_prefix + " _" + std::to_string (KVS_MAX_SNAPSHOTS) + " .json" ));
724724 ASSERT_FALSE (std::filesystem::exists (filename_prefix + " _" + std::to_string (KVS_MAX_SNAPSHOTS) + " .hash" ));
@@ -744,11 +744,11 @@ TEST(kvs_snapshot_rotate, snapshot_rotate_max_snapshots)
744744 ASSERT_TRUE (result);
745745
746746 /* Create empty Test-Snapshot Files */
747- for (size_t i = 1 ; i < KVS_MAX_SNAPSHOTS; i++)
747+ for (size_t i = 0 ; i < KVS_MAX_SNAPSHOTS; i++)
748748 {
749749 std::ofstream (filename_prefix + " _" + std::to_string (i) + " .json" ) << " {}" ;
750750 std::ofstream (filename_prefix + " _" + std::to_string (i) + " .hash" ) << " {}" ;
751- EXPECT_EQ (result.value ().snapshot_count ().value (), i);
751+ EXPECT_EQ (result.value ().snapshot_count ().value (), i+ 1 );
752752 }
753753 ASSERT_FALSE (std::filesystem::exists (filename_prefix + " _" + std::to_string (KVS_MAX_SNAPSHOTS) + " .json" ));
754754 ASSERT_FALSE (std::filesystem::exists (filename_prefix + " _" + std::to_string (KVS_MAX_SNAPSHOTS) + " .hash" ));
@@ -770,11 +770,11 @@ TEST(kvs_snapshot_rotate, snapshot_rotate_failure_renaming_json)
770770 ASSERT_TRUE (result);
771771
772772 /* Create empty Test-Snapshot Files */
773- for (size_t i = 1 ; i < KVS_MAX_SNAPSHOTS; i++)
773+ for (size_t i = 0 ; i < KVS_MAX_SNAPSHOTS; i++)
774774 {
775775 std::ofstream (filename_prefix + " _" + std::to_string (i) + " .json" ) << " {}" ;
776776 std::ofstream (filename_prefix + " _" + std::to_string (i) + " .hash" ) << " {}" ;
777- EXPECT_EQ (result.value ().snapshot_count ().value (), i);
777+ EXPECT_EQ (result.value ().snapshot_count ().value (), i+ 1 );
778778 }
779779
780780 /* Snapshot (JSON) Renaming failed (Create directorys instead of json files to trigger rename
@@ -795,11 +795,11 @@ TEST(kvs_snapshot_rotate, snapshot_rotate_failure_renaming_hash)
795795 ASSERT_TRUE (result);
796796
797797 /* Create empty Test-Snapshot Files */
798- for (size_t i = 1 ; i < KVS_MAX_SNAPSHOTS; i++)
798+ for (size_t i = 0 ; i < KVS_MAX_SNAPSHOTS; i++)
799799 {
800800 std::ofstream (filename_prefix + " _" + std::to_string (i) + " .json" ) << " {}" ;
801801 std::ofstream (filename_prefix + " _" + std::to_string (i) + " .hash" ) << " {}" ;
802- EXPECT_EQ (result.value ().snapshot_count ().value (), i);
802+ EXPECT_EQ (result.value ().snapshot_count ().value (), i+ 1 );
803803 }
804804
805805 /* Hash Renaming failed (Create directorys instead of json files to trigger rename error)*/
@@ -957,12 +957,12 @@ TEST(kvs_snapshot_count, snapshot_count_success)
957957 ASSERT_TRUE (result);
958958
959959 /* Create empty Test-Snapshot Files */
960- for (size_t i = 1 ; i <= KVS_MAX_SNAPSHOTS; i++)
960+ for (size_t i = 0 ; i < KVS_MAX_SNAPSHOTS; i++)
961961 {
962962 std::ofstream (filename_prefix + " _" + std::to_string (i) + " .json" ) << " {}" ;
963963 auto count = result.value ().snapshot_count ();
964964 EXPECT_TRUE (count);
965- EXPECT_EQ (count.value (), i);
965+ EXPECT_EQ (count.value (), i+ 1 );
966966 }
967967 /* Test maximum capacity */
968968 std::ofstream (filename_prefix + " _" + std::to_string (KVS_MAX_SNAPSHOTS + 1 ) + " .json" ) << " {}" ;
0 commit comments