Exemplo n.º 1
0
        public void TestStats()
        {
            testName = "TestStats";
            SetUpTest(true);
            string dbFileName = testHome + "/" +
                                testName + ".db";

            RecnoDatabaseConfig dbConfig =
                new RecnoDatabaseConfig();

            ConfigCase1(dbConfig);
            RecnoDatabase db = RecnoDatabase.Open(dbFileName,
                                                  dbConfig);
            RecnoStats stats = db.Stats();

            ConfirmStatsPart1Case1(stats);

            // Put 1000 records into the database.
            PutRecordCase1(db, null);
            stats = db.Stats();
            ConfirmStatsPart2Case1(stats);

            // Delete 500 records.
            for (int i = 250; i <= 750; i++)
            {
                db.Delete(new DatabaseEntry(BitConverter.GetBytes(i)));
            }
            stats = db.Stats();
            ConfirmStatsPart3Case1(stats);

            db.Close();
        }
Exemplo n.º 2
0
 public void ConfirmStatsPart2Case1(RecnoStats stats)
 {
     Assert.AreEqual(0, stats.DuplicatePages);
     Assert.AreEqual(0, stats.DuplicatePagesFreeBytes);
     Assert.AreNotEqual(0, stats.InternalPages);
     Assert.AreNotEqual(0, stats.InternalPagesFreeBytes);
     Assert.AreNotEqual(0, stats.LeafPages);
     Assert.AreNotEqual(0, stats.LeafPagesFreeBytes);
     Assert.AreEqual(1000, stats.nData);
     Assert.AreEqual(1000, stats.nKeys);
     Assert.AreNotEqual(0, stats.OverflowPages);
     Assert.AreNotEqual(0, stats.OverflowPagesFreeBytes);
 }
Exemplo n.º 3
0
 public void ConfirmStatsPart1Case1(RecnoStats stats)
 {
     Assert.AreEqual(1, stats.EmptyPages);
     Assert.AreEqual(1, stats.Levels);
     Assert.AreNotEqual(0, stats.MagicNumber);
     Assert.AreEqual(10, stats.MetadataFlags);
     Assert.AreEqual(2, stats.MinKey);
     Assert.AreEqual(2, stats.nPages);
     Assert.AreEqual(4096, stats.PageSize);
     Assert.AreEqual(4000, stats.RecordLength);
     Assert.AreEqual(256, stats.RecordPadByte);
     Assert.AreEqual(10, stats.Version);
 }
Exemplo n.º 4
0
 public void ConfirmStatsPart3Case1(RecnoStats stats)
 {
     Assert.AreNotEqual(0, stats.FreePages);
 }