File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ contract rockPaperScissorGame{
6969 }else if (msg .sender == player2.addr){
7070
7171 if ( ! (player2.hasCommitted) ) revert AlreadyCommitted ();
72- player2.committedMove = "" ;
72+ player2.committedMove = _move ;
7373 player2.hasCommitted = true ;
7474
7575 } else {
@@ -167,5 +167,9 @@ contract gameSessionFactory{
167167 function getAllChildContractAddress () external view returns (uint256 ){
168168 return deployedGameSession.length ;
169169 }
170+
171+ function getDeployedContract () external view returns (address [] memory ){
172+ return deployedGameSession;
173+ }
170174
171175}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: UNLICENSED
2+ pragma solidity ^ 0.8.13 ;
3+
4+ import {Test, console} from "forge-std/Test.sol " ;
5+ import {gameSessionFactory} from "../src/gameSessionfactoryContract.sol " ;
6+
7+ contract factoryTest is Test {
8+ gameSessionFactory public game;
9+
10+ function setUp () public {
11+ game = new gameSessionFactory ();
12+ }
13+
14+ //check if it deploys a contract
15+ function testCreatNewContract () public {
16+
17+ game.createNewContract ();
18+
19+ address [] memory games = game.getDeployedContract ();
20+
21+ assertEq (games.length , 1 );
22+ console.log (games.length );
23+
24+ assertTrue (games[0 ] != address (0 ));
25+
26+ console.log (games[0 ]);
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments