Skip to content

Commit

Permalink
GSAGH-544: The 1D steel utilization contour range in Rhino is incorre…
Browse files Browse the repository at this point in the history
…ct (#735)
  • Loading branch information
DominikaLos authored Dec 18, 2024
1 parent 313d612 commit d1820c0
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ namespace GsaGH.Parameters.Results {
public static partial class ExtremaKeyUtility {
public static (SteelUtilisationExtremaKeys Max, SteelUtilisationExtremaKeys Min) GetSteelUtilisationExtremaKeys<T>(
this IDictionary<int, IList<T>> subset) {

var maxValue = new SteelUtilisation(double.MaxValue);
var minValue = new SteelUtilisation(0.0);
var maxValue = new SteelUtilisation(double.MinValue);
var minValue = new SteelUtilisation(double.MaxValue);

var maxKeys = new SteelUtilisationExtremaKeys();
var minKeys = new SteelUtilisationExtremaKeys();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,5 +291,42 @@ public void UpdateExtremaTest() {
Assert.Equal(2, minKeys.Overall.Id);
Assert.Equal(0, minKeys.Overall.Permutation);
}

[Fact]
public void ShouldFindTheLargestAndSmallest() {
var dictionary = new Dictionary<int, IList<SteelUtilisation>>() {
{
3, new List<SteelUtilisation>() {
new SteelUtilisation(0),
}
}, {
2, new List<SteelUtilisation>() {
new SteelUtilisation(1),
}
},
};
(SteelUtilisationExtremaKeys max, SteelUtilisationExtremaKeys min) = dictionary.GetSteelUtilisationExtremaKeys();
Assert.Equal(2, max.Overall.Id);
Assert.Equal(3, min.Overall.Id);
}

[Fact]
public void ShouldLookAtAllItemsOnTheList() {
var dictionary = new Dictionary<int, IList<SteelUtilisation>>() {
{
3, new List<SteelUtilisation>() {
new SteelUtilisation(1),
}
}, {
2, new List<SteelUtilisation>() {
new SteelUtilisation(0),
new SteelUtilisation(2),
}
},
};
(SteelUtilisationExtremaKeys max, SteelUtilisationExtremaKeys min) = dictionary.GetSteelUtilisationExtremaKeys();
Assert.Equal(2, max.Overall.Id);
Assert.Equal(2, min.Overall.Id);
}
}
}

0 comments on commit d1820c0

Please sign in to comment.