Skip to content

Commit

Permalink
Update samples to v1 (#54)
Browse files Browse the repository at this point in the history
* update samples from v1.0 spec
* add updater script for samples
* restore trap cleanup and remove blank lines
  • Loading branch information
daeMOn63 authored and Geal committed Feb 18, 2022
1 parent c85c388 commit a0dcf92
Show file tree
Hide file tree
Showing 44 changed files with 1,776 additions and 304 deletions.
30 changes: 30 additions & 0 deletions datalog/datalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,36 @@ type ID interface {
String() string
}

type Set []ID

func (Set) Type() IDType { return IDTypeSet }
func (s Set) Equal(t ID) bool {
c, ok := t.(Set)
if !ok || len(c) != len(s) {
return false
}

cmap := make(map[ID]struct{}, len(c))
for _, v := range c {
cmap[v] = struct{}{}
}

for _, id := range s {
if _, ok := cmap[id]; !ok {
return false
}
}
return true
}
func (s Set) String() string {
eltStr := make([]string, 0, len(s))
for _, e := range s {
eltStr = append(eltStr, e.String())
}
sort.Strings(eltStr)
return fmt.Sprintf("[%s]", strings.Join(eltStr, ", "))
}

type Symbol uint64

func (Symbol) Type() IDType { return IDTypeSymbol }
Expand Down
6 changes: 6 additions & 0 deletions samples/data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Biscuit samples and expected results

the `v0` folder contains sample tokens and the expected results for pre 1.0
Biscuit

the `v1` folder contain the sample token for Biscuit 1.0
Loading

0 comments on commit a0dcf92

Please sign in to comment.