Skip to content

Commit

Permalink
Added more unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hayakawa16 committed Aug 23, 2024
1 parent b084325 commit db40c98
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,21 @@ public void Validate_duplicate_detector_name_is_invalid()
Assert.IsFalse(result.IsValid);
}

/// <summary>
/// Test to verify that input with Analog specified does not also
/// specify Russian Roulette
/// </summary>
[Test]
public void Validate_Analog_with_Russian_Roulette_is_invalid()
{
// generate input with Analog
var input = new SimulationInput();
input.Options.AbsorptionWeightingType = AbsorptionWeightingType.Analog;
input.Options.RussianRouletteWeightThreshold = 0.1;
var result = SimulationInputValidation.ValidateInput(input);
Assert.IsFalse(result.IsValid);
}

/// <summary>
/// Test to verify input with cylindrical detector and off axis ellipsoid in tissue outputs warning
/// but continues as valid input
Expand Down Expand Up @@ -181,6 +196,27 @@ public void Validate_angled_source_and_cylindrical_detectors_are_not_defined_tog
Assert.That(output.ToString(), Is.EqualTo("Warning: Angled source and cylindrical coordinate detector defined: user discretion advised\r\n"));
}

/// <summary>
/// Test to verify that input with transmittance detector with final tissue region=0
/// is invalid
/// </summary>
[Test]
public void Validate_transmittance_detector_with_final_tissue_region_equal_0_is_invalid()
{
// generate input with transmittance
var input = new SimulationInput
{
DetectorInputs = new List<IDetectorInput> {
new TOfRhoDetectorInput()
{
FinalTissueRegionIndex = 0
}
}
};
var result = SimulationInputValidation.ValidateInput(input);
Assert.IsFalse(result.IsValid);
}

/// <summary>
/// Test to verify input with ellipsoid in tissue and R(fx) detector outputs warning
/// but continues as valid input
Expand Down

0 comments on commit db40c98

Please sign in to comment.