459b6b2f02
The Caching Module Caches the images that have been extracted and for persistence writes the images to a cache file. In the cache file the data is stored by tab separated values `%s\t%s\t%s` the cache is first loaded in the memory ( CACHE_LIST ) during the start of application and then extracted images are added to the map CACHE_LIST which is writtern to the cache file before exiting the program.
17 lines
353 B
Go
17 lines
353 B
Go
package cache
|
|
|
|
import "testing"
|
|
|
|
func TestLoadCache(t *testing.T) {
|
|
expectedResult := [2]string{"hello/wer.jpg", "hello/iwer.jpg"}
|
|
loadCache("./testdata/cache.txt")
|
|
var i int = 0
|
|
for _, v := range CACHE_LIST {
|
|
if v != expectedResult[i] {
|
|
if v != expectedResult[i+1] {
|
|
t.Errorf("Didn't Get The Expected Value receieved %s", v)
|
|
}
|
|
}
|
|
}
|
|
}
|