mirror of
https://github.com/FiloSottile/age.git
synced 2026-01-04 19:33:55 +00:00
testdata: convert last chunk tests to testkit
This commit is contained in:
32
testdata/stream_last_chunk_empty.go
vendored
Normal file
32
testdata/stream_last_chunk_empty.go
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
// Copyright 2022 The age Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build ignore
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
|
||||
"filippo.io/age/internal/testkit"
|
||||
)
|
||||
|
||||
func main() {
|
||||
f := testkit.NewTestFile()
|
||||
// Reuse the file key and nonce from a previous test vector to avoid
|
||||
// bloating the git history with two versions that can't be compressed.
|
||||
fileKey, _ := hex.DecodeString("7aa5bdac0e6afeed3dd0a7eccb42af44")
|
||||
f.FileKey(fileKey)
|
||||
f.VersionLine("v1")
|
||||
f.X25519(testkit.TestX25519Identity)
|
||||
f.HMAC()
|
||||
nonce, _ := hex.DecodeString("c82f71eb82029b77136399e485e879f4")
|
||||
f.Nonce(nonce)
|
||||
f.PayloadChunk(bytes.Repeat([]byte{0}, 64*1024))
|
||||
f.PayloadChunkFinal([]byte{})
|
||||
f.Comment("final STREAM chunk can't be empty unless whole payload is empty")
|
||||
f.ExpectPayloadFailure()
|
||||
f.Generate()
|
||||
}
|
||||
BIN
testdata/stream_last_chunk_empty.test
vendored
Normal file
BIN
testdata/stream_last_chunk_empty.test
vendored
Normal file
Binary file not shown.
29
testdata/stream_last_chunk_full.go
vendored
Normal file
29
testdata/stream_last_chunk_full.go
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright 2022 The age Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build ignore
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
|
||||
"filippo.io/age/internal/testkit"
|
||||
)
|
||||
|
||||
func main() {
|
||||
f := testkit.NewTestFile()
|
||||
// Reuse the file key and nonce from a previous test vector to avoid
|
||||
// bloating the git history with two versions that can't be compressed.
|
||||
fileKey, _ := hex.DecodeString("5085919e0d59b19d6cbd00330f03861c")
|
||||
f.FileKey(fileKey)
|
||||
f.VersionLine("v1")
|
||||
f.X25519(testkit.TestX25519Identity)
|
||||
f.HMAC()
|
||||
nonce, _ := hex.DecodeString("32521791a6f22e11637fb69ead3f2d5f")
|
||||
f.Nonce(nonce)
|
||||
f.PayloadChunkFinal(bytes.Repeat([]byte{0}, 64*1024))
|
||||
f.Generate()
|
||||
}
|
||||
BIN
testdata/stream_last_chunk_full.test
vendored
Normal file
BIN
testdata/stream_last_chunk_full.test
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user