-
Notifications
You must be signed in to change notification settings - Fork 54
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
Showing
3 changed files
with
33 additions
and
2 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
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,27 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/edgelesssys/constellation/v2/internal/verify" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestAllEqual(t *testing.T) { | ||
// Test case 1: One input arg | ||
assert.True(t, allEqual(verify.TCBVersion{Bootloader: 1, Microcode: 2, SNP: 3, TEE: 4}), "Expected allEqual to return true for one input arg, but got false") | ||
|
||
// Test case 2: Three input args that are equal | ||
assert.True(t, allEqual( | ||
verify.TCBVersion{Bootloader: 1, Microcode: 2, SNP: 3, TEE: 4}, | ||
verify.TCBVersion{Bootloader: 1, Microcode: 2, SNP: 3, TEE: 4}, | ||
verify.TCBVersion{Bootloader: 1, Microcode: 2, SNP: 3, TEE: 4}, | ||
), "Expected allEqual to return true for three equal input args, but got false") | ||
|
||
// Test case 3: Three input args where second and third element are different | ||
assert.False(t, allEqual( | ||
verify.TCBVersion{Bootloader: 1, Microcode: 2, SNP: 3, TEE: 4}, | ||
verify.TCBVersion{Bootloader: 2, Microcode: 2, SNP: 3, TEE: 4}, | ||
verify.TCBVersion{Bootloader: 2, Microcode: 3, SNP: 3, TEE: 4}, | ||
), "Expected allEqual to return false for three input args with different second and third elements, but got true") | ||
} |