AbstractTestGridInput

Package: kwave.tests.unit Superclasses: matlab.unittest.TestCase

Superclass for GridInput unit tests.

Description

Abstract test class for testing property classes derived from GridInput. Derived classes must define six abstract properties. The first defines the medium class name, and the others define cell arrays of the medium properties names for the class under test:

  • inputClass - (char) Name of input class.
  • inputProperties - Cell array of property names defined on the non-padded grid that can be either scalar values or spatially varying. For example, inputProperties = {'soundSpeed', 'density'}.
  • inputPropertiesComplex - Cell array of property names defined on the padded grid that must be complex valued. For example, inputPropertiesComplex = {'sourceField'}. Properties declared as complex must also be defined in one of the other input arrays, e.g., inputPropertiesPadded.
  • inputPropertiesPadded - Cell array of property names defined on the padded grid that can be either scalar values or spatially varying. For example, inputPropertiesPadded = {'soundSpeedPadded', 'densityPadded'}.
  • inputPropertiesScalar - Cell array of property names for values that must be scalar values. For example, inputPropertiesScalar = {'soundSpeedReference'}.
  • inputPropertiesVectorField - Cell array of property names for values that must be vector fields. For example, inputPropertiesScalar = {'initialVelocity'}.

Derived classes must also contain a test methods block (which can be empty) so that the tests run:

  methods(Test)
  end

The test class then automatically tests homogeneous and heterogeneous property assignment, padded and non-padded size checks, and error states for grid sizes in 1D, 2D, and 3D.