关于单元测试一个问题
写了一个程序,要从System.in读数据,怎么写JUnit啊,哪位大侠指点一下?
有两个CASE,从console输入,
2 5
1 7 2 10 9
6 11
62 63 54 66 65 61 57 56 50 53 48
0 0
然后可以得到两行结果
Case 1: 2
Case 2: 4
import java.util.*;import java.math.*;public class P1001pku { public static void Main() { Scanner cin = new Scanner(System.in); BigDecimal x; StringBuffer output; int n; x = cin.nextBigDecimal(); n = cin.nextInt(); while (true) { x = x.pow(n).stripTrailingZeros(); output = new StringBuffer(x.toPlainString()); if (output.charAt(0) == '0') System.out.println(output.substring(1)); else System.out.println(output); try { x = cin.nextBigDecimal(); n = cin.nextInt(); } catch (NoSuchElementException e) { break; } } }}