zoukankan      html  css  js  c++  java
  • 0330 单元测试

    import static org.junit.Assert.*;
    
    import java.math.BigDecimal;
    
    import org.junit.Test;
    
    
    
    
    
    
    
    public class test {
         
        @Test
        public void fulitest(){
            System.out.print("
    复利:      ");
            double wh = new fuli().CalculateA(100,1,0.2,2);
            System.out.print(wh);
            
            BigDecimal   b   =   new   BigDecimal(wh);  
            wh   =   b.setScale(2,   BigDecimal.ROUND_HALF_UP).doubleValue();  
            
            boolean test=false;
            
            if(wh-121.00==0)
                test=true;
            else
                test=false;
            assertEquals(true,test);
            
        }
        
        @Test    
        public void danlitest(){
            System.out.print("
    单利:      ");
            double wh = new danli().CalculateA(100,1,0.2);
            System.out.print(wh);
            
            BigDecimal   b   =   new   BigDecimal(wh);  
            wh   =   b.setScale(2,   BigDecimal.ROUND_HALF_UP).doubleValue();  
            
            boolean test=false;
            
            if(wh-120.00==0)
                test=true;
            else
                test=false;
            assertEquals(true,test);
            
        }
        
        @Test    
        public void benjintest(){
            System.out.print("
    本金:      ");
            double wh = new benjin().CalculateA(200,3,0.2,2);
            System.out.print(wh);
            
            BigDecimal   b   =   new   BigDecimal(wh);  
            wh   =   b.setScale(2,   BigDecimal.ROUND_HALF_UP).doubleValue();  
            
            boolean test=false;
            
            if(wh-112.89==0)
                test=true;
            else
                test=false;
            assertEquals(true,test);
            
        }
        
        @Test    
        public void huankuantest(){
            System.out.print("
    还款:      ");
            double wh = new huankuan().CalculateA(200,0.2,10);
            System.out.print(wh);
            
            BigDecimal   b   =   new   BigDecimal(wh);  
            wh   =   b.setScale(2,   BigDecimal.ROUND_HALF_UP).doubleValue();  
            
            boolean test=false;
            
            if(wh-48.00==0)
                test=true;
            else
                test=false;
            assertEquals(true,test);
            
        }
        
        @Test    
        public void lilvtest(){
            System.out.print("
    利率:      ");
            double wh = new lilv().CalculateA(100,200,2,3);
            System.out.print(wh);
            
            BigDecimal   b   =   new   BigDecimal(wh);  
            wh   =   b.setScale(2,   BigDecimal.ROUND_HALF_UP).doubleValue();  
            
            boolean test=false;
            
            if(wh- 0.37==0)
                test=true;
            else
                test=false;
            assertEquals(true,test);
            
        }
        
        @Test    
        public void shijiantest(){
            System.out.print("
    时间:      ");
            double wh = new shijian().CalculateA(100,200,0.2,1);
            System.out.print(wh);
            
            BigDecimal   b   =   new   BigDecimal(wh);  
            wh   =   b.setScale(2,   BigDecimal.ROUND_HALF_UP).doubleValue();  
            
            boolean test=false;
            
            if(wh-3.80==0)
                test=true;
            else
                test=false;
            assertEquals(true,test);
            
        }
        
        @Test    
        public void touzitest(){
            System.out.print("
    投资:      ");
            double wh = new touzi().CalculateA(100,0.2,3);
            System.out.print(wh);
            
            BigDecimal   b   =   new   BigDecimal(wh);  
            wh   =   b.setScale(2,   BigDecimal.ROUND_HALF_UP).doubleValue();  
            
            boolean test=false;
            
            if(wh-436.80==0)
                test=true;
            else
                test=false;
            assertEquals(true,test);
            
        }
    }






    更新说明:本程序由C转Java版,并和252王俊杰同学合作完成。


    合作伙伴:http://www.cnblogs.com/wangjunjie123/p/5336224.html


  • 相关阅读:
    块设备驱动、bio理解
    configfs_sample.c 理解
    configfs-用户空间控制的内核对象配置
    infiniswap安装
    virtualBox环境下安装centos7,设置虚拟主机和本地主机网络互通的几个关键步骤
    知识点-web
    SpringSecutiry源码探究(DAO密码认证)
    知识点-线程
    知识点-基础
    keypoint
  • 原文地址:https://www.cnblogs.com/huang123/p/5336248.html
Copyright © 2011-2022 走看看