private void runReadTest(Test.ParamAction <Object[]> callback) { string xx = "ABCDABCDABCDABCD"; string fpath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string ffilename = Path.Combine(fpath, "file.txt"); using (var streamWriter = new StreamWriter(ffilename, false)) { streamWriter.WriteLine(xx); } Test test = new Test { Name = "ReadFileTest", Callback = callback, TestFunction = (Test.ParamAction <long> retval) => { var time = DateTime.Now.Ticks; for (int i = 0; i < 1000; i++) { string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string filename = Path.Combine(path, "file.txt"); using (var streamReader = new StreamReader(filename)) { while (!streamReader.EndOfStream) { streamReader.ReadLine(); } } } retval(DateTime.Now.Ticks - time); } }; test.Run(); }
private void runVibrateTest(Test.ParamAction <Object[]> callback) { Test test = new Test { Name = "VibrateTest", Callback = callback, TestFunction = (Test.ParamAction <long> retval) => { var time = DateTime.Now.Ticks; Vibration.Vibrate(); retval(DateTime.Now.Ticks - time); } }; test.Run(); }
private void runAudioTest(Test.ParamAction <Object[]> callback) { Test test = new Test { Name = "AudioTest", Callback = callback, TestFunction = (Test.ParamAction <long> retval) => { var time = DateTime.Now.Ticks; DependencyService.Get <IService>().PlayAudioFile("s.mp3"); retval(DateTime.Now.Ticks - time); } }; test.Run(); }
private void runGeolocationTest(int a, int b, Test.ParamAction <Object[]> callback) { Test test = new Test { Name = "Ackermann39", Callback = callback, TestFunction = (Test.ParamAction <long> retval) => { var time = DateTime.Now.Ticks; ackermann(a, b); retval(DateTime.Now.Ticks - time); } }; test.Run(); }
private void runReadStorageTest(Test.ParamAction <object[]> callback) { Test test = new Test { Name = "ReadStorageTest", Callback = callback, TestFunction = (Test.ParamAction <long> retval) => { var time = DateTime.Now.Ticks; for (int i = 0; i < 1000; i++) { var x = Preferences.Get("test", "lol"); } retval(DateTime.Now.Ticks - time); } }; test.Run(); }
private void runWriteStorageTest(int kb, Test.ParamAction <Object[]> callback) { string xx = "ABCDABCDABCDABCD"; Test test = new Test { Name = "WriteStorageTest" + kb + "KB", Callback = callback, TestFunction = (Test.ParamAction <long> retval) => { var time = DateTime.Now.Ticks; for (int i = 0; i < 1000; i++) { Preferences.Set("test", xx); } retval(DateTime.Now.Ticks - time); } }; test.Run(); }
private void runWriteTest(int kb, Test.ParamAction <Object[]> callback) { string xx = "ABCDABCDABCDABCD"; Test test = new Test { Name = "WriteFileTest" + kb + "KB", Callback = callback, TestFunction = (Test.ParamAction <long> retval) => { var time = DateTime.Now.Ticks; for (int j = 0; j < 1000; j++) { string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string filename = Path.Combine(path, "file.txt"); using (var streamWriter = new StreamWriter(filename, false)) { streamWriter.WriteLine(xx); } File.Delete(filename); } retval(DateTime.Now.Ticks - time); } }; test.Run(); }