Created
December 22, 2022 14:38
-
-
Save veridelisi/9bafbcb8f877c5e5204183c4a311d2ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier:GPL-3.0-or-later | |
pragma solidity ^0.8.7; | |
import "forge-std/Test.sol"; | |
import "src/Dots.sol"; | |
contract DotsTest is Test { | |
Dots public dots; | |
address alice; | |
address bob; | |
address owner; | |
function setUp() public { | |
dots = new Dots(); | |
owner = dots.owner(); | |
address alice = vm.addr(1); | |
vm.deal(alice, 5 ether); | |
address bob = vm.addr(2); | |
vm.deal(bob, 5 ether); | |
} | |
function testCountriesNumber() public { | |
assertEq(dots.numberOfCountries(),20); | |
} | |
function testGameIndexNumber() public { | |
assertEq(dots.activeGameIndex(), 0); | |
} | |
function testStartFunction() public { | |
vm.prank(owner); | |
dots.startGame(20, 20, 0.1 ether, 0.0001 ether); | |
vm.startPrank(alice); | |
dots.claimLocation(2,5,8); | |
(bool sent,) = address(this).call{value: 1 ether}(""); | |
require(sent, "Failed"); | |
} | |
function testFailStartFunction() public { | |
vm.prank(alice); | |
dots.startGame(1,2,3,4); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment