Skip to content

Commit

Permalink
Update gold
Browse files Browse the repository at this point in the history
  • Loading branch information
upamanyus committed Dec 17, 2024
1 parent 3db61c3 commit 4c38dab
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 32 deletions.
9 changes: 8 additions & 1 deletion testdata/examples/append_log/append_log.gold.v
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,17 @@ Definition Open : val :=
"diskSz" ::= "$diskSz"
}]))).

Definition pkg_name' : string := "github.com/goose-lang/goose/testdata/examples/append_log".

Definition define' : val :=
rec: "define'" <> :=
exception_do (do: #()).

Definition initialize' : val :=
rec: "initialize'" <> :=
exception_do (do: (define' #())).
globals.package_init pkg_name' (λ: <>,
exception_do (do: disk.initialize';;;
do: marshal.initialize';;;
do: sync.initialize';;;
do: (define' #()))
).
7 changes: 6 additions & 1 deletion testdata/examples/async/async.gold.v
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@ Definition UseDisk : val :=
(interface.get "Write" (![disk.Disk] "d")) "$a0" "$a1");;;
do: ((interface.get "Barrier" (![disk.Disk] "d")) #())).

Definition pkg_name' : string := "github.com/goose-lang/goose/testdata/examples/async".

Definition define' : val :=
rec: "define'" <> :=
exception_do (do: #()).

Definition initialize' : val :=
rec: "initialize'" <> :=
exception_do (do: (define' #())).
globals.package_init pkg_name' (λ: <>,
exception_do (do: async_disk.initialize';;;
do: (define' #()))
).
6 changes: 5 additions & 1 deletion testdata/examples/comments/comments.gold.v
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ Definition Foo__mset : list (string * val) := [
Definition Foo__mset_ptr : list (string * val) := [
].

Definition pkg_name' : string := "github.com/goose-lang/goose/testdata/examples/comments".

Definition define' : val :=
rec: "define'" <> :=
exception_do (do: #()).

Definition initialize' : val :=
rec: "initialize'" <> :=
exception_do (do: (define' #())).
globals.package_init pkg_name' (λ: <>,
exception_do (do: (define' #()))
).

End code.
24 changes: 24 additions & 0 deletions testdata/examples/externalglobals/externalglobals.gold.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
(* autogenerated from github.com/goose-lang/goose/testdata/examples/externalglobals *)
From New.golang Require Import defn.
From New.code Require github_com.goose_lang.goose.testdata.examples.unittest.

From New Require Import disk_prelude.

(* go: g.go:7:6 *)
Definition f : val :=
rec: "f" <> :=
exception_do (let: "$r0" := #(W64 11) in
do: ((globals.get unittest.GlobalX #()) <-[uint64T] "$r0")).

Definition pkg_name' : string := "github.com/goose-lang/goose/testdata/examples/externalglobals".

Definition define' : val :=
rec: "define'" <> :=
exception_do (do: #()).

Definition initialize' : val :=
rec: "initialize'" <> :=
globals.package_init pkg_name' (λ: <>,
exception_do (do: unittest.initialize';;;
do: (define' #()))
).
9 changes: 9 additions & 0 deletions testdata/examples/externalglobals/g.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package externalglobals

import (
"github.com/goose-lang/goose/testdata/examples/unittest"
)

func f() {
unittest.GlobalX = 11
}
9 changes: 8 additions & 1 deletion testdata/examples/logging2/logging2.gold.v
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,17 @@ Definition Begin : val :=
do: ("txn" <-[Txn] "$r0");;;
return: (![Txn] "txn")).

Definition pkg_name' : string := "github.com/goose-lang/goose/testdata/examples/logging2".

Definition define' : val :=
rec: "define'" <> :=
exception_do (do: #()).

Definition initialize' : val :=
rec: "initialize'" <> :=
exception_do (do: (define' #())).
globals.package_init pkg_name' (λ: <>,
exception_do (do: sync.initialize';;;
do: disk.initialize';;;
do: primitive.initialize';;;
do: (define' #()))
).
9 changes: 8 additions & 1 deletion testdata/examples/semantics/semantics.gold.v
Original file line number Diff line number Diff line change
Expand Up @@ -3109,10 +3109,17 @@ Definition disabled_testWal : val :=
do: ("ok" <-[boolT] "$r0");;;
return: (![boolT] "ok")).

Definition pkg_name' : string := "github.com/goose-lang/goose/testdata/examples/semantics".

Definition define' : val :=
rec: "define'" <> :=
exception_do (do: #()).

Definition initialize' : val :=
rec: "initialize'" <> :=
exception_do (do: (define' #())).
globals.package_init pkg_name' (λ: <>,
exception_do (do: disk.initialize';;;
do: sync.initialize';;;
do: primitive.initialize';;;
do: (define' #()))
).
10 changes: 9 additions & 1 deletion testdata/examples/simpledb/simpledb.gold.v
Original file line number Diff line number Diff line change
Expand Up @@ -1048,12 +1048,20 @@ Definition Close : val :=
do: (let: "$a0" := (![Database] "db") in
Shutdown "$a0")).

Definition pkg_name' : string := "github.com/goose-lang/goose/testdata/examples/simpledb".

Definition define' : val :=
rec: "define'" <> :=
exception_do (do: #()).

Definition initialize' : val :=
rec: "initialize'" <> :=
exception_do (do: (define' #())).
globals.package_init pkg_name' (λ: <>,
exception_do (do: marshal.initialize';;;
do: filesys.initialize';;;
do: primitive.initialize';;;
do: sync.initialize';;;
do: (define' #()))
).

End code.
60 changes: 35 additions & 25 deletions testdata/examples/unittest/unittest.gold.v
Original file line number Diff line number Diff line change
Expand Up @@ -896,25 +896,27 @@ Definition foo : val :=
rec: "foo" <> :=
exception_do (return: (#(W64 10))).

Definition GlobalX : val := #"github.com/goose-lang/goose/testdata/examples/unittest.GlobalX".
Definition pkg_name' : string := "github.com/goose-lang/goose/testdata/examples/unittest".

Definition globalY : val := #"github.com/goose-lang/goose/testdata/examples/unittest.globalY".
Definition GlobalX : (string * string) := (pkg_name', "GlobalX").

Definition globalA : val := #"github.com/goose-lang/goose/testdata/examples/unittest.globalA".
Definition globalY : (string * string) := (pkg_name', "globalY").

Definition globalB : val := #"github.com/goose-lang/goose/testdata/examples/unittest.globalB".
Definition globalA : (string * string) := (pkg_name', "globalA").

Definition globalB : (string * string) := (pkg_name', "globalB").

(* go: globals.go:12:6 *)
Definition other : val :=
rec: "other" <> :=
exception_do (let: "$r0" := #"ok" in
do: ((globals.get globalY) <-[stringT] "$r0")).
do: ((globals.get globalY #()) <-[stringT] "$r0")).

(* go: globals.go:16:6 *)
Definition bar : val :=
rec: "bar" <> :=
exception_do (do: (other #());;;
(if: ((![uint64T] (globals.get GlobalX)) ≠ #(W64 10)) || ((![stringT] (globals.get globalY)) ≠ #"ok")
(if: ((![uint64T] (globals.get GlobalX #())) ≠ #(W64 10)) || ((![stringT] (globals.get globalY #())) ≠ #"ok")
then
do: (let: "$a0" := (interface.make string__mset #"bad") in
Panic "$a0")
Expand Down Expand Up @@ -2440,25 +2442,33 @@ Definition testVariadicPassThrough : val :=

Definition define' : val :=
rec: "define'" <> :=
exception_do (globals.put globalB (ref_ty stringT (zero_val stringT));;;
globals.put globalA (ref_ty stringT (zero_val stringT));;;
globals.put globalY (ref_ty stringT (zero_val stringT));;;
globals.put GlobalX (ref_ty uint64T (zero_val uint64T))).
exception_do (do: (globals.put globalB (ref_ty stringT (zero_val stringT)));;;
do: (globals.put globalA (ref_ty stringT (zero_val stringT)));;;
do: (globals.put globalY (ref_ty stringT (zero_val stringT)));;;
do: (globals.put GlobalX (ref_ty uint64T (zero_val uint64T)))).

Definition initialize' : val :=
rec: "initialize'" <> :=
exception_do (do: (define' #());;;
let: "$r0" := (foo #()) in
do: ((globals.get GlobalX) <-[uint64T] "$r0");;;
let: "$r0" := #"a" in
do: ((globals.get globalA) <-[stringT] "$r0");;;
let: "$r0" := #"b" in
do: ((globals.get globalB) <-[stringT] "$r0");;;
do: ((λ: <>,
exception_do (let: "$r0" := (![uint64T] (globals.get GlobalX)) in
do: ((globals.get GlobalX) <-[uint64T] "$r0"))
) #());;;
do: ((λ: <>,
exception_do (let: "$r0" := #"" in
do: ((globals.get globalY) <-[stringT] "$r0"))
) #())).
globals.package_init pkg_name' (λ: <>,
exception_do (do: marshal.initialize';;;
do: log.initialize';;;
do: disk.initialize';;;
do: primitive.initialize';;;
do: sync.initialize';;;
do: fmt.initialize';;;
do: (define' #());;;
let: "$r0" := (foo #()) in
do: ((globals.get GlobalX #()) <-[uint64T] "$r0");;;
let: "$r0" := #"a" in
do: ((globals.get globalA #()) <-[stringT] "$r0");;;
let: "$r0" := #"b" in
do: ((globals.get globalB #()) <-[stringT] "$r0");;;
do: ((λ: <>,
exception_do (let: "$r0" := (![uint64T] (globals.get GlobalX #())) in
do: ((globals.get GlobalX #()) <-[uint64T] "$r0"))
) #());;;
do: ((λ: <>,
exception_do (let: "$r0" := #"" in
do: ((globals.get globalY #()) <-[stringT] "$r0"))
) #()))
).
9 changes: 8 additions & 1 deletion testdata/examples/wal/wal.gold.v
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,17 @@ Definition Open : val :=
"length" ::= "$length"
}])).

Definition pkg_name' : string := "github.com/goose-lang/goose/testdata/examples/wal".

Definition define' : val :=
rec: "define'" <> :=
exception_do (do: #()).

Definition initialize' : val :=
rec: "initialize'" <> :=
exception_do (do: (define' #())).
globals.package_init pkg_name' (λ: <>,
exception_do (do: disk.initialize';;;
do: primitive.initialize';;;
do: sync.initialize';;;
do: (define' #()))
).

0 comments on commit 4c38dab

Please sign in to comment.