package test.leecode.recursion; import org.junit.Assert; import org.junit.Test; import cn.fansunion.leecode.recursion.NthTribonacciNumber; /** * @author wen.lei@brgroup.com * * 2022-3-12 */ public class NthTribonacciNumberTest { @Test public void test() { NthTribonacciNumber test = new NthTribonacciNumber(); Assert.assertEquals( 0 , test.tribonacci( 0 )); Assert.assertEquals( 1 , test.tribonacci( 1 )); Assert.assertEquals( 1 , test.tribonacci( 2 )); Assert.assertEquals( 2 , test.tribonacci( 3 )); Assert.assertEquals( 4 , test.tribonacci( 4 )); Assert.assertEquals( 1389537 , test.tribonacci( 25 )); } @Test public void testDp() { NthTribonacciNumber test = new NthTribonacciNumber(); Assert.assertEquals( 0 , test.tribonacciDp( 0 )); Assert.assertEquals( 1 , test.tribonacciDp( 1 )); Assert.assertEquals( 1 , test.tribonacciDp( 2 )); Assert.assertEquals( 2 , test.tribonacciDp( 3 )); Assert.assertEquals( 4 , test.tribonacciDp( 4 )); Assert.assertEquals( 1389537 , test.tribonacciDp( 25 )); } } |