(t *testing.T)
| 95 | } |
| 96 | |
| 97 | func TestMetaFile_WriteMeta(t *testing.T) { |
| 98 | mFile, err := bfs.OpenMetaFile("testdata/test.m", &sync.RWMutex{}) |
| 99 | if err != nil { |
| 100 | t.Fatal(err) |
| 101 | } |
| 102 | defer func() { |
| 103 | _ = mFile.Close() |
| 104 | }() |
| 105 | |
| 106 | var hash = bfs.Hash("123456") |
| 107 | err = mFile.WriteMeta(hash, 200, fasttime.Now().Unix()+3600, -1) |
| 108 | if err != nil { |
| 109 | t.Fatal(err) |
| 110 | } |
| 111 | |
| 112 | err = mFile.WriteHeaderBlockUnsafe(hash, 123, 223) |
| 113 | if err != nil { |
| 114 | t.Fatal(err) |
| 115 | } |
| 116 | |
| 117 | err = mFile.WriteBodyBlockUnsafe(hash, 223, 323, 0, 100) |
| 118 | if err != nil { |
| 119 | t.Fatal(err) |
| 120 | } |
| 121 | |
| 122 | err = mFile.WriteBodyBlockUnsafe(hash, 323, 423, 100, 200) |
| 123 | if err != nil { |
| 124 | t.Fatal(err) |
| 125 | } |
| 126 | |
| 127 | err = mFile.WriteClose(hash, 100, 200) |
| 128 | if err != nil { |
| 129 | t.Fatal(err) |
| 130 | } |
| 131 | |
| 132 | //logs.PrintAsJSON(mFile.Header(hash), t) |
| 133 | } |
| 134 | |
| 135 | func TestMetaFile_Write(t *testing.T) { |
| 136 | mFile, err := bfs.OpenMetaFile("testdata/test.m", &sync.RWMutex{}) |
nothing calls this directly
no test coverage detected