Java Assert assertMergeTestPostcondition(double[] arr, long[] brr, int arrLen)

Here you can find the source of assertMergeTestPostcondition(double[] arr, long[] brr, int arrLen)

Description

assert Merge Test Postcondition

License

Apache License

Declaration

private static void assertMergeTestPostcondition(double[] arr, long[] brr, int arrLen) 

Method Source Code

//package com.java2s;
/*//  ww w.  j  a v  a 2s . c o m
 * Copyright 2015-16, Yahoo! Inc.
 * Licensed under the terms of the Apache License 2.0. See LICENSE file at the project root for terms.
 */

public class Main {
    private static void assertMergeTestPostcondition(double[] arr, long[] brr, int arrLen) {
        int violationsCount = 0;
        for (int i = 0; i < arrLen - 1; i++) {
            if (arr[i] > arr[i + 1]) {
                violationsCount++;
            }
        }

        for (int i = 0; i < arrLen; i++) {
            if (brr[i] != (long) (1e12 * (1.0 - arr[i])))
                violationsCount++;
        }
        if (brr[arrLen] != 0) {
            violationsCount++;
        }

        assert violationsCount == 0;
    }
}

Related

  1. assertIsReady()
  2. assertLegal(Object underAssertion, String message)
  3. assertLongPositive(long val, String name)
  4. assertMandatoryParameter(boolean assertion, String parameterName)
  5. assertMatches(String name, String regExp, String actual)
  6. assertMessageEquals(Throwable ex, String msg)
  7. assertNonEmpty(String s, String name)
  8. assertNonFatal(boolean test, String msg)
  9. assertNonNegative(int field, String fieldName)