-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5642cc
commit 74a4fac
Showing
6 changed files
with
98 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
.vscode/ | ||
.gitattributes | ||
*.code-workspace | ||
*.code-workspace | ||
|
||
# using TestClass.cls for objecscript functionality exploration / convince myself that things work the way I expect them to | ||
cls/SourceControl/Git/TestClass.cls |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Class UnitTest.SourceControl.Git.PrivateMemoryStore Extends %UnitTest.TestCase | ||
{ | ||
|
||
Method TestInsert() | ||
{ | ||
set pvtMemStore = ##class(SourceControl.Git.Util.PrivateMemoryStore).%New(16) | ||
set keys = $lb("a", "b", "c") | ||
set values = $lb("123456", "789101112", "131415161718") | ||
set n = $ListLength(keys) | ||
do ..InsertToMemoryStore(pvtMemStore, keys, values) | ||
|
||
for i=1:1:n { | ||
Set key = $List(keys,i) | ||
Set expectedValue = $List(values,i) | ||
|
||
do $$$AssertEquals(pvtMemStore.Retrieve(key), expectedValue) | ||
} | ||
} | ||
|
||
ClassMethod InsertToMemoryStore(store, keys, ByRef values) | ||
{ | ||
set n = $ListLength(keys) | ||
for i=1:1:n { | ||
Set key = $List(keys,i) | ||
Set value = $List(values,i) | ||
do store.Store(key, value) | ||
} | ||
} | ||
|
||
Method TestDelete() | ||
{ | ||
set pvtMemStore = ##class(SourceControl.Git.Util.PrivateMemoryStore).%New(16) | ||
set keys = $lb("a", "b", "c") | ||
set values = $lb("123456", "789101112", "131415161718") | ||
do ..InsertToMemoryStore(pvtMemStore, keys, values) | ||
set n = $ListLength(keys) | ||
|
||
for i=1:1:n-1 { | ||
do pvtMemStore.Clear($List(keys,i)) | ||
} | ||
|
||
for i=1:1:n-1 { | ||
do $$$AssertEquals(pvtMemStore.KeyExists($List(keys,i)), 0) | ||
} | ||
|
||
do $$$AssertEquals(pvtMemStore.Retrieve($List(keys,n)), $List(values,n)) | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
test/UnitTest/SourceControl/Git/PrivateMemoryStoreTest.cls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Import SourceControl.Git.Util | ||
|
||
Class test.UnitTest.SourceControl.Git.Util.PrivateMemoryStoreTest Extends %UnitTest.TestCase | ||
{ | ||
|
||
Method TestInsert() | ||
{ | ||
set pvtMemStore = ##class(PrivateMemoryStore).%New(16) | ||
set keys = $lb("a", "b", "c") | ||
set values = $lb("123456", "789101112", "131415161718") | ||
set n = $ListLength(keys) | ||
for i=1:1:n { | ||
Set key = $List(keys,i) | ||
Set value = $List(values,i) | ||
|
||
do pvtMemStore.Store(key, value) | ||
} | ||
for i=1:1:n { | ||
Set key = $List(keys,i) | ||
Set expectedValue = $List(values,i) | ||
|
||
do $$$AssertEquals(pvtMemStore.Retrieve(key), expectedValue) | ||
} | ||
} | ||
|
||
} |