Esempio n. 1
0
	BenchmarkWrite                	  200000	    191115 ns/op
	BenchmarkReadWrite            	  100000	    210732 ns/op

	After adding a fast path for sequential appends/reads:

	BenchmarkWrite                	10000000	       209 ns/op
	BenchmarkReadWrite            	10000000	       192 ns/op


	After allocating blocks with Size bytes by default:

	BenchmarkWrite                	100000000	        15.5 ns/op
	BenchmarkReadWrite            	50000000	        29.1 ns/op
*/

var Printf = dbg.FuncPrintf(os.Stdout, testing.Verbose)

func TestEmpty(t *testing.T) {
	Size = 128
	debug = testing.Verbose()
	var buf Blocks
	var what [100]byte

	if buf.Len() != 0 {
		t.Fatal("wrong len")
	}
	b, _ := buf.Open()
	nr, _ := b.Read(what[:])
	if nr != 0 {
		t.Fatal("didn't get eof")
	}
Esempio n. 2
0
	"clive/net/auth"
	"clive/net/fifo"
	"clive/zx"
	"clive/zx/mfs"
	"clive/zx/fstest"
	"clive/zx/lfs"
	"clive/zx/rfs"
	"os"
	"time"
	"testing"
)

const tdir = "/tmp/lfs_test"

var (
	printf = dbg.FuncPrintf(os.Stderr, testing.Verbose)
	mktrees = mklfstrees
	moreverb = false
)


func TestParse(t *testing.T) {
	os.Args[0] = "nstest"
	s := `/	/
/tmp	*!*!lfs!main!/tmp
`

	outs := `path:"/" name:"/" type:"d" mode:"0755" proto:"lfs" spath:"/" tpath:"/"
path:"/tmp" name:"tmp" type:"d" mode:"0777" proto:"lfs" spath:"/" tpath:"/tmp"
`
	ns, err := Parse(s)