40 lines
728 B
Go
40 lines
728 B
Go
package bloat_test
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"git.bivouac.wiki/go/bloat"
|
|
)
|
|
|
|
// TestPlain without keys...
|
|
func TestPlain(t *testing.T) {
|
|
type foo struct {
|
|
Abc bool
|
|
Plain string
|
|
}
|
|
sender, err := bloat.NewBloat[foo](true)
|
|
if err != nil {
|
|
t.Errorf("init failed")
|
|
}
|
|
data := foo{
|
|
Abc: true,
|
|
Plain: "this is plain",
|
|
}
|
|
recipient, err := bloat.NewBloat[foo](true)
|
|
if err != nil {
|
|
t.Errorf("recipient init failed")
|
|
}
|
|
plain, err := sender.Write(data, recipient)
|
|
if err != nil {
|
|
t.Errorf("writing plain failed")
|
|
}
|
|
fmt.Println(plain)
|
|
res, err := recipient.Read(plain, sender)
|
|
if res.Plain != "this is plain" {
|
|
t.Errorf("text does not match")
|
|
}
|
|
if err != nil {
|
|
t.Errorf("verification failed")
|
|
}
|
|
}
|