diff --git a/.github/workflows/src.yml b/.github/workflows/src.yml index 8d6bedf..0c0e228 100644 --- a/.github/workflows/src.yml +++ b/.github/workflows/src.yml @@ -7,9 +7,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: aviate-labs/setup-dfx@v0.2.2 + - uses: aviate-labs/setup-dfx@v0.2.3 with: - dfx-version: 0.8.0 - install-moc: true + dfx-version: 0.8.4 vessel-version: 0.6.2 - - run: for i in src/*.mo ; do moc $(vessel sources) --check $i ; done + - run: for i in src/*.mo ; do $(vessel bin)/moc $(vessel sources) --check $i ; done diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cfc02cd..bec6d0f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,9 +7,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: aviate-labs/setup-dfx@v0.2.2 + - uses: aviate-labs/setup-dfx@v0.2.3 with: - dfx-version: 0.8.0 - install-moc: true + dfx-version: 0.8.4 vessel-version: 0.6.2 - - run: for i in test/*.mo ; do moc $(vessel sources) -r $i ; done + - run: for i in test/*.mo ; do $(vessel bin)/moc $(vessel sources) -r $i ; done diff --git a/src/XorShift.mo b/src/XorShift.mo index 5946a27..7d5b901 100644 --- a/src/XorShift.mo +++ b/src/XorShift.mo @@ -25,7 +25,7 @@ module { state ^= (state >> 12); state ^= (state << 25); state ^= (state >> 27); - state * 2685821657736338717; + state *% 2685821657736338717; }; }; diff --git a/test/XorShift.mo b/test/XorShift.mo new file mode 100644 index 0000000..1360b01 --- /dev/null +++ b/test/XorShift.mo @@ -0,0 +1,19 @@ +import Hash "mo:base/Hash"; +import Nat "mo:base/Nat"; +import Nat64 "mo:base/Nat64"; +import Text "mo:base/Text"; +import TrieSet "mo:base/TrieSet"; + +import XorShift "../src/XorShift"; + +import Debug "mo:base/Debug"; + +var r = XorShift.XorShift64(null); +var s = TrieSet.empty(); +var i = 0; +while (i < 99) { + let n = Nat64.toText(r.next()); + s := TrieSet.put(s, n, Text.hash(n), Text.equal); + i += 1; +}; +assert(TrieSet.size(s) == 99);