Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AdSecGH-63 Fix unflatten Test #98

Closed
wants to merge 7 commits into from
Closed

AdSecGH-63 Fix unflatten Test #98

wants to merge 7 commits into from

Conversation

DominikaLos
Copy link
Collaborator

No description provided.

@DominikaLos DominikaLos changed the title AdSec-63 fix for TestSection - unflattened AdSec-63 Fix unflatten Test Aug 6, 2024
@DominikaLos DominikaLos changed the title AdSec-63 Fix unflatten Test AdSecGH-63 Fix unflatten Test Aug 6, 2024
@psarras
Copy link
Collaborator

psarras commented Aug 7, 2024

@DominikaLos there is a failure on the test due to the pre-commit module. Can you make sure you setup this locally? I have added instruction how to do that on the README.

Once you do this you will be able to do pre-commit run and fix the file, there recommit.

@DominikaLos DominikaLos marked this pull request as ready for review August 7, 2024 09:56

TestSection(flattened, actualSection);
}

private void TestSection(ISection expected, ISection actual) {
private static void TestSection(ISection expected, ISection actual, bool unflattened = false) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we put this comparison at the core GSA.GH project withi this signature

public class SectionHelper
{
    public static bool Equal(ISection sectionA, ISection sectionB, bool unflattened){...}
}

then this method can simply call the previous one

{
    Assert.True(SectionHelper.Equal(expected, actual, unflattened))
}

Assert.Equal(((ISingleBars)expected.ReinforcementGroups[0]).Positions[0].Z.Value, ((ISingleBars)actual.ReinforcementGroups[0]).Positions[0].Z.Value, 4);
Assert.Equal(((ISingleBars)expected.ReinforcementGroups[0]).BarBundle.CountPerBundle, ((ISingleBars)actual.ReinforcementGroups[0]).BarBundle.CountPerBundle);
Assert.Equal(((ISingleBars)expected.ReinforcementGroups[0]).BarBundle.Diameter, ((ISingleBars)actual.ReinforcementGroups[0]).BarBundle.Diameter);
if (!unflattened) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SandeepArup is there a method for testing if a Section if unflattened or flatten? I don't like that we dictate if that is the case. There must be an internal flag we can reuse?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RaviKumarGubbala @vilayatk is there any flag which tell section is unflattened or flatten?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such kind of check shouldn't be there. Is it added becuase test are failing? I think the test fails becuase CountPerBundle cant be checked before after flatten. If there are three bars per bundle, it might be geting converted to three single bars. After confirming the behaviour we could update/delete the check related CountPerBundle. @SandeepArup

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree @RaviKumarGubbala. However, "It might be" OR always converting bar in bundle to single bars?

These tests are json sterilization and deserialization test i.e. b/w flatten and original section and vice-versa and have only one bar in bundle. So, test should not fail in either case. @DominikaLos lets discuss this tomorrow.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@psarras I had some discussion with @RaviKumarGubbala and have feeling that after flattening section, profile will get changed(although section geometry will remain same) and so center of gravity and rebar position will be changed relative to new Origin/CG position and there is no guarantee that we can match the position with original section.

And second things, why these tests? Should we write test for third party library? If consuming Revit API or Grasshopper API, should we write test for their functionalities? If we are finding some issue in AdSec API then It should be reported to AdSec team for resolution.

So, in my opinion, these test should not be here.

Copy link
Collaborator

@psarras psarras Aug 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SandeepArup Hey! I agree we shouldn't be testing GSA.API here. I will need to look into more detail to understand if we simply remove them, however, I have the feeling they are also testing some secondary functionality, of which we need a test. So perhaps we morph this problem to something that helps us.

Copy link

codecov bot commented Nov 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 23.1%. Comparing base (fcdf31a) to head (a08a5ed).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main     #98   +/-   ##
=====================================
  Coverage   23.1%   23.1%           
=====================================
  Files         77      77           
  Lines       6197    6197           
  Branches     811     811           
=====================================
  Hits        1437    1437           
  Misses      4729    4729           
  Partials      31      31           

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants