package bloat_test import ( "os" "testing" "git.bivouac.wiki/go/bloat" ) func TestFile(t *testing.T) { type txttype struct { Abc int Test bool } recip, err := bloat.NewEncBloat[txttype]() sender, err := bloat.NewEncBloat[txttype]() plaindata := txttype{Abc: 100, Test: true} data, err := sender.WriteEnc(plaindata, recip) err = os.WriteFile("test/data.txttype.bloat", data, 0664) if err != nil { t.Errorf("writing failed") } content, err := os.ReadFile("test/data.txttype.bloat") dec, err := recip.ReadEnc(content, sender) if dec.Test != plaindata.Test { t.Errorf("not equal") } if dec.Abc != plaindata.Abc { t.Errorf("not equal") } }