Functions

func assertCaughtUnexpectedE(String, String, String, Option<AssertionCtx>)

public func assertCaughtUnexpectedE(
    message: String,
    expectedExceptions: String,
    caughtException: String,
    optParentCtx!: ?AssertionCtx = None
): Nothing

Description: Records the message and throws an exception when the caught exceptions do not meet the expectation.

Parameters:

  • message: String: message displayed when the caught exceptions do not meet the expectation
  • expectedExceptions: String: caught exceptions that meet the expectation
  • caughtException: String: actually caught exception
  • optParentCtx!: Option<AssertionCtx>: context that stores the nested assertion failure message

func assertEqual<T>(String, String, T, T, Option<AssertionCtx>): Unit where T <: Equatable<T>

public func assertEqual<T>(
    leftStr: String,
    rightStr: String,
    expected: T,
    actual: T,
    optParentCtx!: ?AssertionCtx = None): Unit where T <: Equatable<T>

Description: Checks whether the value of expected is equal to that of actual. If not, an exception is thrown.

Parameters:

  • leftStr: String: string of the expected expression
  • rightStr: String: string of the actual expression
  • expected: T: expected value
  • actual: T: actual value
  • optParentCtx!: Option<AssertionCtx>: context that stores the nested assertion failure message

func defaultConfiguration()

public func defaultConfiguration(): Configuration

Description: Generates default configuration information.

Returns:

func entryMain(TestPackage)

public func entryMain(testPackage: TestPackage): Int64

Description: Provides the entry function for the cjc --test framework to execute test cases.

Parameters:

Returns:

  • Int64: execution result

func expectCaughtUnexpectedE(String, String, String, Option<AssertionCtx>)

public func expectCaughtUnexpectedE(
    message: String,
    expectedExceptions: String,
    caughtException: String,
    optParentCtx!: ?AssertionCtx = None
): Unit

Description: Records the message and does not throw an exception when the caught exceptions do not meet the expectation.

Parameters:

  • message: String: message displayed when the caught exceptions do not meet the expectation
  • expectedExceptions: String: caught exceptions that meet the expectation
  • caughtException: String: actually caught exception
  • optParentCtx!: Option<AssertionCtx>: context that stores the nested assertion failure message

func expectEqual<T>(String, String, T, T, Option<AssertionCtx>): Unit where T <: Equatable<T>

public func expectEqual<T>(
    leftStr: String,
    rightStr: String,
    expected: T,
    actual: T,
    optParentCtx!: ?AssertionCtx
): Unit where T <: Equatable<T>

Description: Checks whether the value of expected is equal to that of actual. Records the comparison result and does not throw an exception.

Parameters:

  • leftStr: String: string of the expected expression
  • rightStr: String: string of the actual expression
  • expected: T: expected value
  • actual: T: actual value
  • optParentCtx!: Option<AssertionCtx>: context that stores the nested assertion failure message

func fail(String)

public func fail(message: String): Nothing

Description: Makes the case fail and throws an exception.

Parameters:

  • message: String: failure message

func failExpect(String)

public func failExpect(message: String): Unit

Description: Makes the case fail, records the message, and does not throw an exception.

Parameters:

  • message: String: failure message

func invokeCustomAssert<T>(Array<String>, String, (AssertionCtx) -> T, Option<AssertionCtx>)

public func invokeCustomAssert<T>(
    passerdArgs: Array<String>,
    caller: String,
    assert: (AssertionCtx) -> T,
    optParentCtx!: ?AssertionCtx = None
): T

Description: Runs the custom assertion function specified by @Assert\[caller\](passerArgs) used in the @Test, @TestCase, or @CustomAssertion macro.

Parameters:

  • passedArgs: Array<String>: passed parameters that are not processed
  • caller: String: name of a custom assertion that is called
  • assert: (AssertionCtx) -> T: caught assertion calls with correct parameters
  • optParentCtx!: Option<AssertionCtx>: context that stores the nested assertion failure message

Returns:

  • T: value returned by the custom assertion

func invokeCustomExpect(Array<String>, String, (AssertionCtx) -> Any, Option<AssertionCtx>)

public func invokeCustomExpect(
    passerdArgs: Array<String>,
    caller: String,
    expect: (AssertionCtx) -> Any,
    optParentCtx!: ?AssertionCtx = None
): Unit

Description: Runs the custom assertion function specified by @Expect\[caller\](passerArgs) used in the @Test, @TestCase, or @CustomAssertion macro.

Parameters:

  • passedArgs: Array<String>: passed parameters that are not processed
  • caller: String: name of a custom assertion that is called
  • expect: (AssertionCtx) -> Any: caught assertion calls with correct parameters
  • optParentCtx!: Option<AssertionCtx>: context that stores the nested assertion failure message