标签:int 四则运算 namespace method ext mes check com names
四则运算代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ClassLibrary1
{
public void Add (int a ,int b)
{
return a - b ;
}
public void Add (int a ,int b)
{
return a /b ;
}
}
单元测试代码:
TEST_METHOD(TestSub)
{
Test.CheckInput("1/2-1/3");
Assert::AreEqual(test21, Test.sub());
}
TEST_METHOD(TestSub1)
{
Test.CheckInput("1/3-2");
Assert::AreEqual(test22, Test.sub());
}
TEST_METHOD(TestSub2)
{
Test.CheckInput("2-1/3");
Assert::AreEqual(test23, Test.sub());
}
TEST_METHOD(TestSub3)
{
Test.CheckInput("5-3");
Assert::AreEqual(test24, Test.sub());
}
TEST_METHOD(TestDiv)
{
Test.CheckInput("1/2÷2");
Assert::AreEqual(test41, Test.div());
}
TEST_METHOD(TestDiv1)
{
Test.CheckInput("4÷1/2");
Assert::AreEqual(test42, Test.div());
}
TEST_METHOD(TestDiv2)
{
Test.CheckInput("1/2÷2/3");
Assert::AreEqual(test43, Test.div());
}
TEST_METHOD(TestDiv3)
{
Test.CheckInput("1÷2");
Assert::AreEqual(test44, Test.div());
}
标签:int 四则运算 namespace method ext mes check com names
原文地址:https://www.cnblogs.com/ajaj/p/14644937.html