COCOS-159 - Improve test coverage to 65% (#310)

* few atls tests

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* remove commented code

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* add atls tests

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* new line

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* add more test cases

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* more test cases

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* add empty line and parallel test cases

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* move const outside test case

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

---------

Signed-off-by: Sammy Oina <sammyoina@gmail.com>
This commit is contained in:
Sammy Kerata Oina
2024-11-19 10:13:33 +03:00
committed by GitHub
parent d5941edb56
commit 5a22ac2eca
11 changed files with 698 additions and 184 deletions
+21
View File
@@ -38,6 +38,13 @@ func TestCopyFile(t *testing.T) {
}
}
func TestCopyFile_NonExistentSource(t *testing.T) {
err := CopyFile("nonexistent.txt", "destination.txt")
if err == nil {
t.Error("CopyFile did not return an error for a nonexistent source file")
}
}
func TestDeleteFilesInDir(t *testing.T) {
tempDir, err := os.MkdirTemp("", "deletefiles_test")
if err != nil {
@@ -111,6 +118,13 @@ func TestChecksum(t *testing.T) {
}
}
func TestChecksum_NonExistentFile(t *testing.T) {
_, err := Checksum("nonexistent.txt")
if err == nil {
t.Error("Checksum did not return an error for a nonexistent file")
}
}
func TestChecksumHex(t *testing.T) {
tempFile, err := os.CreateTemp("", "checksumhex_test")
if err != nil {
@@ -134,3 +148,10 @@ func TestChecksumHex(t *testing.T) {
t.Errorf("ChecksumHex mismatch. Got %s, want %s", checksumHex, expectedChecksumHex)
}
}
func TestChecksumHex_NonExistentFile(t *testing.T) {
_, err := ChecksumHex("nonexistent.txt")
if err == nil {
t.Error("ChecksumHex did not return an error for a nonexistent file")
}
}