Testreport

这篇博客包含一系列针对Jumper类的测试用例,主要关注Jumper是否会在移动时跳出边界,以及如何根据遇到的花和石头调整跳跃行为。测试涵盖了边界条件、首个和第二个单元格有花或石头的情况,通过这些测试可以验证Jumper对象的行为是否符合预期。
摘要由CSDN通过智能技术生成

Jumper测试

测试点:

  1. Jummper是否会跳出边界
  • Test Code

    // @file: Part3/JumperTest.java
    // @line: 15~23
    @Test
    public void test1() {
    	/*
    	 * case: Boundary
    	 */
    	ActorWorld world = new ActorWorld();
    	Jumper alice = new Jumper();
    	world.add(new Location(0, 9), alice);
    	assertEquals(false, alice.canJump());
    }
    
    
  1. Jumper移动方向上第一个cell有花
  • Test Code

    // @file: Part3/JumperTest.java
    // @line: 26~36
    @Test
    public void test2() {
    	/*
    	 * case: Flower on the first cell in direction
    	 */
    	ActorWorld world = new ActorWorld();
    	Jumper alice = new Jumper();
    	Flower flower = new Flower();
    	world.add(new Location(2, 3), alice);
    	world.add(new Location(1, 3), flower);
    	assertEquals(true, alice.canJump());
    }
    
  1. Jumper移动方向上第一个cell有石头
  • Test Code

    // @file: Part3/JumperTest.java
    // @line: 38~49
    @Test
    public void test3() {
    	/*
    	 * case: Rock on the first cell in direction
    	 */
    	ActorWorld world = new ActorWorld();
    	Jumper alice = new Jumper();
    	Rock rock = new Rock();
    	world.add(new Location(2, 3), alice);
    	world.add(new Location(1, 3), rock);
    	assertEquals(true, alice.canJump());
    }
    
  1. Jumper移动方向上第二个cell上有花
  • Test Code

    // @file: Part3/JumperTest.java
    // @line: 51~62
    @Test
    public void test4() {
    	/*
    	 * case: Flower on the second cell in direction
    	 */
    	ActorWorld world = new ActorWorld();
    	Jumper alice = new Jumper();
    	Flower flower = new Flower();
    	world.add(new Location(2, 3), alice);
    	world.add(new Location(0, 3), flower);
    	assertEquals(true, alice.canJump());
    }
    
  1. Jumper移动方向上第二个cell上有石头
  • Test Code

    // @file: Part3/JumperTest.java
    // @line: 65~75
    @Test
    public void test5() {
    	/*
    	 * case: Rock on the second cell in direction
    	 */
    	ActorWorld world = new ActorWorld();
    	Jumper alice = new Jumper();
    	Rock rock = new Rock();
    	world.add(new Location(2, 3), alice);
    	world.add(new Location(0, 3), rock);
    	assertEquals(false, alice.canJump());
    }
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值