Skip to content

Commit

Permalink
Move files from /realm -> /r
Browse files Browse the repository at this point in the history
  • Loading branch information
harry-hov committed Sep 26, 2023
1 parent 4927740 commit 9f00075
Show file tree
Hide file tree
Showing 19 changed files with 48 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: rules
on:
pull_request:
paths:
- "realm/chess/rules.gno"
- "r/chess/rules.gno"
push:
branches:
- master
Expand All @@ -19,4 +19,4 @@ jobs:
with:
go-version: 'stable'
- run: go mod download -x
- run: go run github.com/gnolang/gno/gnovm/cmd/gno test -verbose -run 'TestPerft' ./realm/chess
- run: go run github.com/gnolang/gno/gnovm/cmd/gno test -verbose -run 'TestPerft' ./r/chess
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,22 @@ help: ## Display this help message.
cd web; npm run build
cd web; npm run dev

4_deploy_chess_realm: ## Deploy GnoChess realm on local node.
4_deploy_realms: ## Deploy realms on local node.
echo | $(GNOKEY) maketx addpkg \
--insecure-password-stdin \
--gas-wanted 20000000 \
--gas-fee 1ugnot \
--pkgpath gno.land/r/demo/chess \
--pkgdir ./realm/chess \
--pkgdir ./r/chess \
--broadcast \
DeployKey

z_deploy_reward_entry_realm: ## Deploy reward entry realm on local node.

echo | $(GNOKEY) maketx addpkg \
--insecure-password-stdin \
--gas-wanted 2000000 \
--gas-fee 1ugnot \
--pkgpath gno.land/r/demo/reward_entry \
--pkgdir ./realm/reward_entry \
--pkgdir ./r/reward_entry \
--broadcast \
DeployKey

Expand All @@ -114,6 +113,6 @@ z_test_integration: ## Test the realm.

z_build_chess_realm: ## Precompile and build the generated Go files. Assumes a working clone of gno in ../gno.
mkdir -p ../gno/examples/gno.land/r/gnochess
cp -rf realm/chess/*.gno ../gno/examples/gno.land/r/gnochess
cp -rf r/chess/*.gno ../gno/examples/gno.land/r/gnochess
go run github.com/gnolang/gno/gnovm/cmd/gno precompile --verbose ../gno/examples/gno.land
go run github.com/gnolang/gno/gnovm/cmd/gno build --verbose ../gno/examples/gno.land/r/gnochess
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
41 changes: 41 additions & 0 deletions r/reward_entry/whitelist_test.gno
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package reward_entry

import (
"std"
"testing"
)

func TestAssertIsWhiteListed(t *testing.T) {
// Mock whitelist
whitelist := []string{std.Address("address1"), std.Address("address2"), std.Address("address3")}

// Test with a valid address
validAddress := std.Address("address1")
assertIsWhiteListed(validAddress) // This should not panic

// // Test with an invalid address
// invalidAddress := std.Address("invalid_address")

// // This should cause a panic
// func() {
// defer func() {
// if r := recover(); r == nil {
// t.Errorf("Expected panic for invalid address, but the function did not panic")
// }
// }()
// assertIsWhiteListed(invalidAddress)
// }()

// // Test with an empty whitelist
// whitelist = []string{}

// // This should cause a panic
// func() {
// defer func() {
// if r := recover(); r == nil {
// t.Errorf("Expected panic for empty whitelist, but the function did not panic")
// }
// }()
// assertIsWhiteListed(validAddress)
// }()
}

0 comments on commit 9f00075

Please sign in to comment.