OSDN Git Service

Merge pull request #201 from Bytom/v0.1
[bytom/vapor.git] / vendor / github.com / tendermint / tmlibs / db / c_level_db_test.go
diff --git a/vendor/github.com/tendermint/tmlibs/db/c_level_db_test.go b/vendor/github.com/tendermint/tmlibs/db/c_level_db_test.go
deleted file mode 100644 (file)
index e7336cc..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-// +build gcc
-
-package db
-
-import (
-       "bytes"
-       "fmt"
-       "testing"
-
-       . "github.com/tendermint/tmlibs/common"
-)
-
-func BenchmarkRandomReadsWrites2(b *testing.B) {
-       b.StopTimer()
-
-       numItems := int64(1000000)
-       internal := map[int64]int64{}
-       for i := 0; i < int(numItems); i++ {
-               internal[int64(i)] = int64(0)
-       }
-       db, err := NewCLevelDB(Fmt("test_%x", RandStr(12)), "")
-       if err != nil {
-               b.Fatal(err.Error())
-               return
-       }
-
-       fmt.Println("ok, starting")
-       b.StartTimer()
-
-       for i := 0; i < b.N; i++ {
-               // Write something
-               {
-                       idx := (int64(RandInt()) % numItems)
-                       internal[idx] += 1
-                       val := internal[idx]
-                       idxBytes := int642Bytes(int64(idx))
-                       valBytes := int642Bytes(int64(val))
-                       //fmt.Printf("Set %X -> %X\n", idxBytes, valBytes)
-                       db.Set(
-                               idxBytes,
-                               valBytes,
-                       )
-               }
-               // Read something
-               {
-                       idx := (int64(RandInt()) % numItems)
-                       val := internal[idx]
-                       idxBytes := int642Bytes(int64(idx))
-                       valBytes := db.Get(idxBytes)
-                       //fmt.Printf("Get %X -> %X\n", idxBytes, valBytes)
-                       if val == 0 {
-                               if !bytes.Equal(valBytes, nil) {
-                                       b.Errorf("Expected %v for %v, got %X",
-                                               nil, idx, valBytes)
-                                       break
-                               }
-                       } else {
-                               if len(valBytes) != 8 {
-                                       b.Errorf("Expected length 8 for %v, got %X",
-                                               idx, valBytes)
-                                       break
-                               }
-                               valGot := bytes2Int64(valBytes)
-                               if val != valGot {
-                                       b.Errorf("Expected %v for %v, got %v",
-                                               val, idx, valGot)
-                                       break
-                               }
-                       }
-               }
-       }
-
-       db.Close()
-}
-
-/*
-func int642Bytes(i int64) []byte {
-       buf := make([]byte, 8)
-       binary.BigEndian.PutUint64(buf, uint64(i))
-       return buf
-}
-
-func bytes2Int64(buf []byte) int64 {
-       return int64(binary.BigEndian.Uint64(buf))
-}
-*/