zoukankan      html  css  js  c++  java
  • TextForfogit

    caculator
    package com.example.liuy.textforforgit;

    /**
    * Created by liuY on 2017/3/13.
    */

    public class caculator {
    public double sum(double a,double b){
    return a+b;
    }

    public double substract(double a,double b) {
    return a-b;
    }
    public double divide(double a,double b){
    return a/b;
    }
    public double multiply(double a,double b){
    return a*b;
    }
    }
    caculatorText
    package com.example.liuy.textforforgit;

    import org.junit.After;
    import org.junit.Before;
    import org.junit.Test;

    import static org.junit.Assert.*;

    /**
    * Created by liuY on 2017/3/13.
    */
    public class caculatorTest {


    private caculator mcaculator;
    @Before
    public void setUp() throws Exception {
    mcaculator=new caculator();
    }
    @After
    public void tearDown() throws Exception {

    }

    @Test
    public void sum() throws Exception {
    assertEquals(20d,mcaculator.sum(10d,10d),0);


    }

    @Test
    public void substract() throws Exception {
    assertEquals(1d,mcaculator.substract(5d,4d),0);

    }

    @Test
    public void divide() throws Exception {
    assertEquals(4d,mcaculator.divide(20d,5d),0);

    }

    @Test
    public void multiply() throws Exception {
    assertEquals(100d,mcaculator.multiply(50d,2d),0);

    }



    }

    
    
  • 相关阅读:
    编程 判断 是否满足条件 的 验证代码。
    Javascript作用域详解。
    DateTable To Json
    反射_获取字段的Description信息
    C# Json格式
    jQuery选择器
    SQL日期格式转换
    【转载】#pragma once与#ifndef
    C++中的左值与右值
    HTML、CSS基础知识
  • 原文地址:https://www.cnblogs.com/u1118746/p/6561894.html
Copyright © 2011-2022 走看看