Skip to content

Commit

Permalink
consolidate rpc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjit-bhat committed Jun 10, 2024
1 parent 2f25fc1 commit 4c9f1a8
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 169 deletions.
6 changes: 1 addition & 5 deletions rpc/compiler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,9 @@ type entry struct {
}

var data = []entry{
{"ints/ints.go", "ints/ints.golden", 1},
{"types/types.go", "types/types.golden", 1},
{"alias/alias.go", "alias/alias.golden", 1},
{"mult/mult.go", "mult/mult.golden", 3},
{"otherpkg/otherpkg.go", "otherpkg/otherpkg.golden", 1},
{"bool/bool.go", "bool/bool.golden", 1},
{"slice/slice.go", "slice/slice.golden", 1},
{"slicelen/slicelen.go", "slicelen/slicelen.golden", 1},
}

// tmpWrite writes data to a tmp file and returns the tmp file name.
Expand Down
5 changes: 0 additions & 5 deletions rpc/testdata/bool/bool.go

This file was deleted.

30 changes: 0 additions & 30 deletions rpc/testdata/bool/bool.golden

This file was deleted.

6 changes: 0 additions & 6 deletions rpc/testdata/ints/ints.go

This file was deleted.

36 changes: 0 additions & 36 deletions rpc/testdata/ints/ints.golden

This file was deleted.

1 change: 0 additions & 1 deletion rpc/testdata/otherpkg/otherpkg.go

This file was deleted.

15 changes: 0 additions & 15 deletions rpc/testdata/otherpkg/otherpkg.golden

This file was deleted.

5 changes: 0 additions & 5 deletions rpc/testdata/slice/slice.go

This file was deleted.

30 changes: 0 additions & 30 deletions rpc/testdata/slice/slice.golden

This file was deleted.

6 changes: 0 additions & 6 deletions rpc/testdata/slicelen/slicelen.go

This file was deleted.

30 changes: 0 additions & 30 deletions rpc/testdata/slicelen/slicelen.golden

This file was deleted.

9 changes: 9 additions & 0 deletions rpc/testdata/types/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package rpc

type args struct {
a1 uint64
a2 bool
a3 []byte
// Invariant: len 16.
a4 []byte
}
48 changes: 48 additions & 0 deletions rpc/testdata/types/types.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Auto-generated from spec "github.com/mit-pdos/pav/rpc/testdata/types/types.go"
// using compiler "github.com/mit-pdos/pav/rpc".
package rpc

import (
"github.com/mit-pdos/pav/marshalutil"
"github.com/tchajed/marshal"
)

type errorTy = bool

const (
errNone errorTy = false
errSome errorTy = true
)

func (o *args) encode() []byte {
var b = make([]byte, 0)
b = marshal.WriteInt(b, o.a1)
b = marshalutil.WriteBool(b, o.a2)
b = marshalutil.WriteSlice1D(b, o.a3)
b = marshal.WriteBytes(b, o.a4)
return b
}
func (o *args) decode(b0 []byte) ([]byte, errorTy) {
var b = b0
a1, b, err := marshalutil.SafeReadInt(b)
if err {
return nil, err
}
a2, b, err := marshalutil.ReadBool(b)
if err {
return nil, err
}
a3, b, err := marshalutil.ReadSlice1D(b)
if err {
return nil, err
}
a4, b, err := marshalutil.SafeReadBytes(b, 16)
if err {
return nil, err
}
o.a1 = a1
o.a2 = a2
o.a3 = a3
o.a4 = a4
return b, errNone
}

0 comments on commit 4c9f1a8

Please sign in to comment.