This program checking whether its String is empty. SO, i test it working

correctly
pull/90/head
minsu4107 5 years ago
parent 6db605e0fd
commit b10a397743

@ -1,6 +1,8 @@
package io.nayuki.qrcodegen;
import static org.junit.Assert.*;
import java.util.EmptyStackException;
import org.junit.Test;
public class testQrSegmentAdvanced {
@ -14,6 +16,8 @@ public class testQrSegmentAdvanced {
private static int min_version = QrCode.MIN_VERSION;
private static int max_version = QrCode.MAX_VERSION;
private String nullstring = "";
/**
*Purpose: Testing when user insert over text length
*Input: overString, Ecc.LOW, minversion = 1, maxversion = 40
@ -34,10 +38,10 @@ public class testQrSegmentAdvanced {
@Test
public void is_valid_Test() {
assertEquals(QrSegmentAdvanced.is_valid_version(min_version, 1),1);
assertEquals(QrSegmentAdvanced.is_valid_version(min_version, 10),1);
assertEquals(QrSegmentAdvanced.is_valid_version(min_version, 27),1);
assertNotEquals(QrSegmentAdvanced.is_valid_version(min_version, 0),1);
assertEquals(QrSegmentAdvanced.is_valid_version(min_version, 1),true);
assertEquals(QrSegmentAdvanced.is_valid_version(min_version, 10),true);
assertEquals(QrSegmentAdvanced.is_valid_version(min_version, 27),true);
assertNotEquals(QrSegmentAdvanced.is_valid_version(min_version, 0),true);
}
/**
@ -48,12 +52,23 @@ public class testQrSegmentAdvanced {
* Unless it has correct range in version's range, if you insert min_version is bigger that max_version, it return 0;
*/
@Test
public void not_Valid_Version_test() {
assertEquals(QrSegmentAdvanced.not_Valid_Version(1, 40), 1);
assertNotEquals(QrSegmentAdvanced.not_Valid_Version(1, 41), 1);
assertNotEquals(QrSegmentAdvanced.not_Valid_Version(0, 40), 1);
assertNotEquals(QrSegmentAdvanced.not_Valid_Version(5, 4), 1);
assertEquals(QrSegmentAdvanced.not_Valid_Version(1, 40), false);
assertNotEquals(QrSegmentAdvanced.not_Valid_Version(1, 41), false);
assertNotEquals(QrSegmentAdvanced.not_Valid_Version(0, 40), false);
assertNotEquals(QrSegmentAdvanced.not_Valid_Version(5, 4), false);
}
/**
*Purpose: This program checking whether its String is empty. SO, i test it working correctly
*Input: 1, nullstring, Ecc.Low, 1, 40
*Expected:
* occur AssertError
*/
@Test(expected = AssertionError.class)
public void emptyString_test() {
testing.makeSegmentsOptimally(nullstring, Ecc.LOW, 1, 40);
}
}

Loading…
Cancel
Save