zoukankan      html  css  js  c++  java
  • 复利计算—单元测试

    1、手动测试:

    2、代码测试:

     1 package invest;
     2 
     3 import static org.junit.Assert.*;
     4 import static org.hamcrest.CoreMatchers.*;
     5 import org.junit.Test;
     6 
     7 public class CompundingTest {
     8 
     9     
    10     
    11     @Test
    12     public void testCompunding() {
    13         double F=Compunding.compunding(50000, 0.05, 10,1);
    14         assertThat(F, is(81444.7313388721));
    15     }
    16 
    17     @Test
    18     public void testSimple_interest() {
    19         double F=Compunding.simple_interest(50000, 0.05, 10);
    20         assertThat(F, is(75000.0));
    21     }
    22 
    23     @Test
    24     public void testCount_Deposit() {
    25         double P=Compunding.Deposit(50000, 0.05, 10,1);
    26         assertThat(P, is(30695.66267703796));
    27     }
    28 
    29     
    30     
    31     @Test
    32     public void testCount_invest() {
    33         double F=Compunding.invest(10000, 0.1, 10,1);
    34         assertThat(F, is(175311.67061100024));
    35     }
    36     
    37     @Test
    38     public void testCount_refunt() {
    39         double P1=Compunding.year_refunt(1000000,0.09, 20);
    40         //double P2=Compunding.month_refunt(1000000,0.09, 20);
    41         assertThat(P1, is(98100.0000));
    42         //assertThat(P2, is(7556.2500));
    43     }
    44 
    45 }

  • 相关阅读:
    寒假每日总结(八)
    寒假每日总结(七)
    寒假每日总结(六)
    2020-2.19
    2020-2.18
    寒假每日总结-2020.2.11
    寒假每日总结-2020.2.10
    寒假每日总结-2020.2.9
    寒假每日总结
    寒假每日总结——2020.2.6
  • 原文地址:https://www.cnblogs.com/moliny/p/5339304.html
Copyright © 2011-2022 走看看