Skip to content

Test/resource mgt#48

Open
bacchuongdaungo wants to merge 8 commits into
release-v2.0from
test/resource-mgt
Open

Test/resource mgt#48
bacchuongdaungo wants to merge 8 commits into
release-v2.0from
test/resource-mgt

Conversation

@bacchuongdaungo
Copy link
Copy Markdown

testcases for basic functionality and edge cases

@bacchuongdaungo bacchuongdaungo changed the base branch from main to release-v2.0 November 4, 2024 23:12
Copy link
Copy Markdown
Owner

@lhmcgann lhmcgann left a comment

Choose a reason for hiding this comment

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

I didn't look as closely at the specific test cases or asserts yet, but will do so after edits are made for the few comments left in this review. Also, if you can doc-comment all your test classes and methods, as well as all the library classes, methods, properties, etc they're testing, that would be great! Some examples in the commit I added to this branch

Comment thread src/EStimLibrary/Core/ReusableIdPool.cs Outdated
Comment thread src/EStimLibrary/Core/ReusableIdPool.cs Outdated
Comment thread src/EStimLibrary/Core/ReusableIdPool.cs Outdated
Comment thread src/EStimLibrary/Core/ReusableIdPool.cs Outdated
Comment thread src/EStimLibrary/Core/ReusableIdPool.cs Outdated
public int NumTotalResources => this.IdPool.NumUsedIds;
public int NumTotalResources => this.Resources.Count;

// Constructor
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Make this a docstring comment, i.e., ///, etc
Also, include docstring comments for all classes, properties, fields, and methods

Comment thread src/EStimLibrary/Core/ResourceManager.cs
// TODO: does Used check validity again?
return this.IdPool.IsValidId(globalId) &&
this.IdPool.IsUsed(globalId);
this.IdPool.IsUsed(globalId) && this.Resources.ContainsKey(globalId);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Is this line needed? Was it failing before? the IdPool.IsValidID + IsUsed checks should be equivalent, so if it was failing before, something bigger is broken

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

For the current implementation of IsValidId and IsUsed, it is crucial to have the line since we are checking for the resource. I have tried to implement the check in UseId but i can't do that without initiating an instance of ResourceManager, so I think it's simpler to have the check inside the RMgr class.

Comment thread src/EStimLibrary/Core/ResourceManager.cs Outdated
Comment thread src/EStimLibrary/Core/ResourceManager.cs Outdated
…within the min-max boundaries.

-Adjust IncrementNumIds correspondingly.
-Added unit test cases for constructor and IncrementNumId-Adjust TryAddResource to pass new test cases in ResourceManager.
IsWithinUpperBound
Added test cases
Replace int.MaxValue with Constants.POS_INFINITY
Refix TryAddResource
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.

2 participants