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

Added coverage and validations #11

Merged
merged 7 commits into from
Jul 10, 2018
Merged

Added coverage and validations #11

merged 7 commits into from
Jul 10, 2018

Conversation

mtabacman
Copy link
Member

No description provided.

@mtabacman mtabacman added the WIP Work in progress label Jul 5, 2018
@mtabacman mtabacman requested a review from gcotelli July 5, 2018 20:42
@coveralls
Copy link

coveralls commented Jul 5, 2018

Pull Request Test Coverage Report for Build 39

  • 637 of 637 (100.0%) changed or added relevant lines in 10 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 22: 0.0%
Covered Lines: 1295
Relevant Lines: 1295

💛 - Coveralls

@gcotelli gcotelli added Status: In Progress and removed WIP Work in progress labels Jul 6, 2018
@@ -1,32 +1,116 @@
"
I'm an abstract class aiding with the creation of graphs.
I'm a builder of directed graphs
Copy link
Member

Choose a reason for hiding this comment

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

This comment needs to be updated


{ #category : #building }
GraphBuilder >> buildUndirected [

This comment was marked as resolved.

GraphBuilder >> connect: aSourceVertex to: aTargetVertex labeled: aLabel [

"In graph theory, the edge label can be any element attached to it. It is possible to label an edge with a name, a color, a weight or even a function."

Copy link
Member

Choose a reason for hiding this comment

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

I would say even an object instead of a function ;)


^ self subclassResponsibility
^ UndirectedEdge
relating: (Bag with: edgeArray first with: edgeArray last)
Copy link
Member

Choose a reason for hiding this comment

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

edgeArray asBag ?

{ #category : #private }
UndirectedEdge >> isLabeledLike: anEdge [

^ self

This comment was marked as outdated.

self
addVertex: aSourceVertex;
addVertex: aTargetVertex.
labelByEdgeArray at: (Array with: aSourceVertex with: aTargetVertex) put: aLabelOptional
Copy link
Member

Choose a reason for hiding this comment

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

Why not { aSourceVertex. aTargetVertex } ?

{ #category : #testing }
Edge >> isDirected [

^ self subclassResponsibility

This comment was marked as resolved.

ifUnlabeled: [ self fail ] ].
self assertCollection: labelByEdge keys hasSameElements: aDictionary keys.
aDictionary
keysAndValuesDo: [ :edgeString :weight | self assert: (labelByEdge at: edgeString) equals: weight ]
Copy link
Member

Choose a reason for hiding this comment

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

This kind of test can be non-deterministic because the string you create in the match dictionary are fixed, and the other ones are generated here. The endpoints in the undirected edge ends up in a Bag or Set, so the order can be different, then the string also can be different.

stream := WriteStream on: String new.
edgeFunction := [ :source :target |
stream
nextPutAll: ('From <1s> to <2s' expandMacrosWith: source with: target);
Copy link
Member

Choose a reason for hiding this comment

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

'From <1s> to <2s' is missing a > no?

@gcotelli

This comment has been minimized.

@@ -23,11 +23,10 @@ GraphTest >> assertEdgesIncidentTo: aVertex in: aGraph match: aDictionary [
edges
do: [ :edge |
edge
withLabelDo: [ :label | labelByEdge at: edge asString put: label ]
withLabelDo: [ :label | labelByEdge at: edge endpoints asSortedCollection asArray asString put: label ]
Copy link
Member

Choose a reason for hiding this comment

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

You can do edge endpoints sorted asString

@gcotelli gcotelli merged commit 9c16091 into master Jul 10, 2018
@gcotelli gcotelli deleted the metadata branch July 10, 2018 20:09
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.

None yet

3 participants