Merge pull request #694 from hapifhir/fix-describe-size-test

Fix describeSizeTest
This commit is contained in:
dotasek 2021-12-17 17:46:35 -05:00 committed by GitHub
commit 4d8b2e8be2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 9 deletions

View File

@ -110,27 +110,30 @@ class UtilitiesTest {
return file.getAbsolutePath().substring(0, file.getAbsolutePath().lastIndexOf('/')) + '/';
}
public static final int BOUND = 500;
public static final int BOUND = 499;
public static final Random RAND = new Random();
public static final int GB_MEASURE_JUST_OVER = (int) Math.pow(Utilities.ONE_MB, 3) + RAND.nextInt(BOUND);
public static int nextInt() {
return 1 + RAND.nextInt(BOUND);
}
public static final int GB_MEASURE_JUST_OVER = (int) Math.pow(Utilities.ONE_MB, 3) + nextInt();
public static final int GB_MEASURE_EXACT = (int) Math.pow(Utilities.ONE_MB, 3);
public static final int GB_MEASURE_JUST_UNDER = (int) Math.pow(Utilities.ONE_MB, 3) - RAND.nextInt(BOUND);
public static final int GB_MEASURE_JUST_UNDER = (int) Math.pow(Utilities.ONE_MB, 3) - nextInt();
public static final int MB_MEASURE_JUST_OVER = (int) Math.pow(Utilities.ONE_MB, 2) + RAND.nextInt(BOUND);
public static final int MB_MEASURE_JUST_OVER = (int) Math.pow(Utilities.ONE_MB, 2) + nextInt();
public static final int MB_MEASURE_EXACT = (int) Math.pow(Utilities.ONE_MB, 2);
public static final int MB_MEASURE_JUST_UNDER = (int) Math.pow(Utilities.ONE_MB, 2) - RAND.nextInt(BOUND);
public static final int MB_MEASURE_JUST_UNDER = (int) Math.pow(Utilities.ONE_MB, 2) - nextInt();
public static final int KB_MEASURE_JUST_OVER = Utilities.ONE_MB + RAND.nextInt(BOUND);
public static final int KB_MEASURE_JUST_OVER = Utilities.ONE_MB + nextInt();
public static final int KB_MEASURE_EXACT = Utilities.ONE_MB;
public static final int KB_MEASURE_JUST_UNDER = Utilities.ONE_MB - RAND.nextInt(BOUND);
public static final int KB_MEASURE_JUST_UNDER = Utilities.ONE_MB - nextInt();
public static final int BT_MEASURE = Utilities.ONE_MB + RAND.nextInt(BOUND);
public static final int BT_MEASURE = Utilities.ONE_MB + nextInt();
public static final int EMPTY = 0;
public static final int BIG_NEG = Utilities.ONE_MB * -1;
private static final String buildMeasureLimitMessage(int size, String contains) {
return MessageFormat.format("\"{0}\" should contain \"{1}\"", size, contains);
}