2 Star 5 Fork 1

幽默者 / testdriven

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
WeixinRedEnvelopesTest.java 735 Bytes
一键复制 编辑 Web IDE 原始数据 按行查看 历史
幽默者 提交于 2015-05-28 23:33 . 微信红包算法
package com.wss.lsl.test.driven.arithmetic.prob;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.math.BigDecimal;
import org.junit.Test;
public class WeixinRedEnvelopesTest {
@Test
public void testGeneralPlay() {
BigDecimal money = new BigDecimal("1.00");
int numberOfPeople = 3;
BigDecimal[] result = WeixinRedEnvelopes.generalPlay(money,
numberOfPeople);
for (BigDecimal item : result) {
System.out.println(item);
}
BigDecimal actualMoney = new BigDecimal("0.00");
for (BigDecimal item : result) {
if (item.doubleValue() < 0.01) {
assertFalse(true);
}
actualMoney = actualMoney.add(item);
}
assertTrue(money.equals(actualMoney));
}
}
Java
1
https://gitee.com/weishengshui/testdriven.git
git@gitee.com:weishengshui/testdriven.git
weishengshui
testdriven
testdriven
master

搜索帮助

14c37bed 8189591 565d56ea 8189591