Advertisement
Guest User

Untitled

a guest
May 21st, 2018
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. package pup
  2.  
  3. import (
  4. "testing"
  5.  
  6. "github.com/yewno/cobalt-50/services"
  7. "github.com/yewno/log"
  8. )
  9.  
  10. func TestProcess(t *testing.T) {
  11.  
  12. ctx := services.NewMockServiceContext()
  13.  
  14. record := services.NewMockRecord("../../test", "files/pup//kelly_epub_samples/9781906897697.epub", 1)
  15.  
  16. pairs, err := Process(ctx, record)
  17. if err != nil {
  18. t.Error(err)
  19. }
  20. log.Infof("pairs %v", pairs)
  21. stats := ctx.Storage.Stats()
  22. log.Infof("copy %v", stats.Copies)
  23. log.Infof("get %v", stats.Gets)
  24. log.Infof("put %v", stats.Puts)
  25.  
  26. assert(1337, len(pairs), "Pairs length", t)
  27. }
  28.  
  29. func assert(expected interface{}, actual interface{}, fieldName string, t *testing.T) {
  30. if expected != actual {
  31. t.Errorf("expected %s to be %s, but actual get %s", fieldName, expected, actual)
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement