Skip to content

Commit 6363d4c

Browse files
author
Kapil Borle
committed
Add a test case for directed graph implementation
1 parent 001e85b commit 6363d4c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Tests/Engine/Helpers.tests.ps1

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
Import-Module PSScriptAnalyzer
2-
$helperNamespace = 'Microsoft.Windows.PowerShell.ScriptAnalyzer';
3-
42

53
Describe "Test Directed Graph" {
64
Context "When a graph is created" {
@@ -9,17 +7,21 @@ Describe "Test Directed Graph" {
97
$digraph.AddVertex('v2');
108
$digraph.AddVertex('v3');
119
$digraph.AddVertex('v4');
10+
$digraph.AddVertex('v5');
11+
1212
$digraph.AddEdge('v1', 'v2');
13+
$digraph.AddEdge('v1', 'v5');
1314
$digraph.AddEdge('v2', 'v4');
1415

1516
It "correctly adds the vertices" {
16-
$digraph.NumVertices | Should Be 4
17+
$digraph.NumVertices | Should Be 5
1718
}
1819

1920
It "correctly adds the edges" {
20-
$digraph.GetNumNeighbors('v1') | Should Be 1
21+
$digraph.GetNumNeighbors('v1') | Should Be 2
2122
$neighbors = $digraph.GetNeighbors('v1')
22-
$neighbors[0] | Should Be 'v2'
23+
$neighbors -contains 'v2' | Should Be $true
24+
$neighbors -contains 'v5' | Should Be $true
2325
}
2426

2527
It "finds the connection" {

0 commit comments

Comments
 (0)