enable --gc:orc testing (#49)

This commit is contained in:
Andreas Rumpf 2021-02-25 17:52:26 +01:00 committed by GitHub
parent a065c17418
commit b602bd469b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 8 deletions

View File

@ -8,7 +8,7 @@
# #
## This is example of usage ``CFB[T]`` encryption/decryption. ## This is example of usage ``CFB[T]`` encryption/decryption.
## ##
## In this sample we are using CFB[AES256], but you can use any block ## In this sample we are using CFB[AES256], but you can use any block
## cipher from nimcrypto library. ## cipher from nimcrypto library.
import nimcrypto import nimcrypto
@ -117,7 +117,7 @@ block:
var ectx, dctx: CFB[aes256] var ectx, dctx: CFB[aes256]
var key = newString(aes256.sizeKey) var key = newString(aes256.sizeKey)
var iv = newString(aes256.sizeBlock) var iv = newString(aes256.sizeBlock)
var plainText = aliceData var plainText = newString(len(aliceData))
var encText = newString(len(aliceData)) var encText = newString(len(aliceData))
var decText = newString(len(aliceData)) var decText = newString(len(aliceData))

View File

@ -8,7 +8,7 @@
# #
## This is example of usage ``CTR[T]`` encryption/decryption. ## This is example of usage ``CTR[T]`` encryption/decryption.
## ##
## In this sample we are using CTR[AES256], but you can use any block ## In this sample we are using CTR[AES256], but you can use any block
## cipher from nimcrypto library. ## cipher from nimcrypto library.
import nimcrypto import nimcrypto
@ -123,7 +123,10 @@ block:
var key = newString(aes256.sizeKey) var key = newString(aes256.sizeKey)
var iv = newString(aes256.sizeBlock) var iv = newString(aes256.sizeBlock)
# We do not need to pad data, `CTR` mode works byte by byte. # We do not need to pad data, `CTR` mode works byte by byte.
var plainText = aliceData var plainText = newString(len(aliceData))
copyMem(addr plainText[0], addr aliceData[0], len(aliceData))
var encText = newString(len(aliceData)) var encText = newString(len(aliceData))
var decText = newString(len(aliceData)) var decText = newString(len(aliceData))

View File

@ -8,7 +8,7 @@
# #
## This is example of usage ``OFB[T]`` encryption/decryption. ## This is example of usage ``OFB[T]`` encryption/decryption.
## ##
## In this sample we are using OFB[AES256], but you can use any block ## In this sample we are using OFB[AES256], but you can use any block
## cipher from nimcrypto library. ## cipher from nimcrypto library.
import nimcrypto import nimcrypto
@ -117,7 +117,7 @@ block:
var ectx, dctx: OFB[aes256] var ectx, dctx: OFB[aes256]
var key = newString(aes256.sizeKey) var key = newString(aes256.sizeKey)
var iv = newString(aes256.sizeBlock) var iv = newString(aes256.sizeBlock)
var plainText = aliceData var plainText = newString(len(aliceData))
var encText = newString(len(aliceData)) var encText = newString(len(aliceData))
var decText = newString(len(aliceData)) var decText = newString(len(aliceData))

View File

@ -13,18 +13,25 @@ requires "nim > 0.18.0"
# Tests # Tests
task test, "Runs the test suite": task test, "Runs the test suite":
let testCommands = @[ var testCommands = @[
"nim c -f -r tests/", "nim c -f -r tests/",
"nim c -f -d:danger -r tests/", "nim c -f -d:danger -r tests/",
"nim c -f -d:danger --threads:on -r tests/", "nim c -f -d:danger --threads:on -r tests/",
] ]
when (NimMajor, NimMinor) >= (1, 5):
testCommands.add "nim c -f --gc:orc --threads:on -r tests/"
let exampleFiles = @[ let exampleFiles = @[
"ecb", "cbc", "ofb", "cfb", "ctr", "gcm" "ecb", "cbc", "ofb", "cfb", "ctr", "gcm"
] ]
let exampleCommands = @[ var exampleCommands = @[
"nim c -f -r --threads:on examples/", "nim c -f -r --threads:on examples/",
] ]
when (NimMajor, NimMinor) >= (1, 5):
exampleCommands.add "nim c -f --gc:orc --threads:on -r examples/"
for cmd in testCommands: for cmd in testCommands:
echo "\n" & cmd & "testall" echo "\n" & cmd & "testall"
exec cmd & "testall" exec cmd & "testall"