CS代写 package comp1110.exam;

package comp1110.exam;

import org.junit.FixMethodOrder;
import org.junit.Rule;

Copyright By PowCoder代写 加微信 powcoder

import org.junit.Test;
import org.junit.rules.Timeout;
import org.junit.runners.MethodSorters;

import static org.junit.Assert.assertTrue;

@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class Q1MagicTest {
public Timeout globalTimeout = Timeout.millis(500);

public void testEmpty() {
test(“”, false);

public void testOne() {
test(“2”, true);
test(“6”, true);
test(“7”, false);
test(“9”, true);
test(“0”, false);

public void testTwo() {
test(“33”, true);
test(“22”, true);
test(“62”, true);
test(“52”, false);
test(“25”, false);

public void testThree() {
test(“336”, true);
test(“228”, true);
test(“627”, true);
test(“331”, false);
test(“221”, false);
test(“625”, false);
test(“526”, false);
test(“252”, false);

public void testFive() {
test(“3362”, true);
test(“2286”, true);
test(“6272”, false);
test(“6273”, true);
test(“3363”, true);
test(“2283”, true);
test(“6273”, true);
test(“3315”, false);
test(“2213”, false);
test(“6252”, false);
test(“5262”, false);
test(“2522”, false);

private void test(String s, boolean e) {
boolean r = Q1Magic.magic(s);
assertTrue(“For string \””+s+”\”, expected ‘”+e+”‘ but got ‘”+r+”‘”, e == r);

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com