Back to project page 2048GameAndroid.
The source code is released under:
Apache License
If you think the Android project 2048GameAndroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package zhengxiao.myapplication.game; /*from w w w . j av a 2 s .c o m*/ import android.test.AndroidTestCase; import android.util.Log; import java.text.MessageFormat; /** * Created by gerald on 12/17/14. */ public class GameTest extends AndroidTestCase { private static final String TAG = GameTest.class.getSimpleName(); private Game game; private Game.Callback callback = new Game.Callback() { @Override public void render(Board board) { Log.i(TAG, MessageFormat.format("board: {0}", board.toString())); } @Override public void gameOver(int finalScore) { Log.i(TAG, "Game Over, final score" + finalScore); } }; @Override protected void setUp() throws Exception { super.setUp(); game = new Game(callback); } /** * ??????????????? */ public void testGameSetup() { assertNotNull(game); assertNotNull(game.board); assertEquals("initial board should have 2 block to be non-zero" + game.board.toString(), Game.ROW_COUNT * Game.ROW_COUNT, game.board.listAllEmptyPositions().size() + 2); } }