From 08bbe7c917c06c1176bc079516193f3466aa912b Mon Sep 17 00:00:00 2001 From: Ella Pietraroia Date: Thu, 6 Feb 2020 17:00:10 +1030 Subject: [PATCH] file added --- filter/filter_test.go | 75 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 filter/filter_test.go diff --git a/filter/filter_test.go b/filter/filter_test.go new file mode 100644 index 00000000..bb6eb22d --- /dev/null +++ b/filter/filter_test.go @@ -0,0 +1,75 @@ +/* +NAME + filter_test.go + +DESCRIPTION + See Readme.md + +AUTHORS + Ella Pietraroia + +LICENSE + This is Copyright (C) 2019 the Australian Ocean Lab (AusOcean). + + It is free software: you can redistribute it and/or modify them + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + It is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + in gpl.txt. If not, see http://www.gnu.org/licenses. +*/ + +// To make a new file for testing please go to test repository test/test-data/av/input/motion-detection/byte_saver.go + +package filter + +import ( + "fmt" + "io" + "os" + "testing" +) + +//frames into a byte slice of 10 + +func BenchmarkBasic(b *testing.B) { + file, _ := os.Create("test_outMOG.mjpeg") + w := io.WriteCloser(file) + f := NewBasic(w, false, 45000, 1000) + fmt.Print("\nFrames: ", len(testPackets)) + for n := 0; n < b.N; n++ { + for _, x := range testPackets { + f.Write(x) + } + } +} + +func BenchmarkDifference(b *testing.B) { + file, _ := os.Create("test_outMOG.mjpeg") + w := io.WriteCloser(file) + f := NewDifference() + fmt.Print("\nFrames: ", len(testPackets)) + for n := 0; n < b.N; n++ { + for _, x := range testPackets { + f.Write(x) + } + } +} + +func BenchmarkMOG(b *testing.B) { + file, _ := os.Create("test_outMOG.mjpeg") + w := io.WriteCloser(file) + f := NewMOGFilter(w, 25, 20, 500, false, 1) + fmt.Print("\nFrames: ", len(testPackets)) + for n := 0; n < b.N; n++ { + for _, x := range testPackets { + f.Write(x) + } + } +}