Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pup
- import (
- "testing"
- "github.com/yewno/cobalt-50/services"
- "github.com/yewno/log"
- )
- func TestProcess(t *testing.T) {
- ctx := services.NewMockServiceContext()
- record := services.NewMockRecord("../../test", "files/pup//kelly_epub_samples/9781906897697.epub", 1)
- pairs, err := Process(ctx, record)
- if err != nil {
- t.Error(err)
- }
- log.Infof("pairs %v", pairs)
- stats := ctx.Storage.Stats()
- log.Infof("copy %v", stats.Copies)
- log.Infof("get %v", stats.Gets)
- log.Infof("put %v", stats.Puts)
- assert(1337, len(pairs), "Pairs length", t)
- }
- func assert(expected interface{}, actual interface{}, fieldName string, t *testing.T) {
- if expected != actual {
- t.Errorf("expected %s to be %s, but actual get %s", fieldName, expected, actual)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement