From 097016ab246dddc4897ce48acba32590c07a828e Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 18 Feb 2013 10:55:24 +0000 Subject: [PATCH] upptst: Stream64PutGet git-svn-id: svn://ultimatepp.org/upp/trunk@5823 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- upptst/Stream64PutGet/Stream64PutGet.cpp | 35 ++++++++++++++++++++++++ upptst/Stream64PutGet/Stream64PutGet.upp | 9 ++++++ upptst/Stream64PutGet/init | 4 +++ 3 files changed, 48 insertions(+) create mode 100644 upptst/Stream64PutGet/Stream64PutGet.cpp create mode 100644 upptst/Stream64PutGet/Stream64PutGet.upp create mode 100644 upptst/Stream64PutGet/init diff --git a/upptst/Stream64PutGet/Stream64PutGet.cpp b/upptst/Stream64PutGet/Stream64PutGet.cpp new file mode 100644 index 000000000..d274deb4c --- /dev/null +++ b/upptst/Stream64PutGet/Stream64PutGet.cpp @@ -0,0 +1,35 @@ +#include + +using namespace Upp; + +CONSOLE_APP_MAIN +{ + StdLogSetup(LOG_FILE|LOG_COUT); + const int64 sz = (int64)5 * 1000 * 1000 * 1000; + String path = GetHomeDirFile("test.bin"); + { + Buffer big(sz); + LOG("Allocated"); + for(int64 i = 0; i < sz; i++) { + big[i] = i % 123; + } + FileOut out(path); + out.Put64(big, sz); + LOG("Saved"); + } + { + FileIn in(path); + for(int64 i = 0; i < sz; i++) + ASSERT(in.Get() == i % 123); + LOG("Loaded by bytes"); + } + { + Buffer big(sz); + FileIn in(path); + ASSERT(in.GetAll64(big, sz)); + LOG("Loaded by GetAll64"); + for(int64 i = 0; i < sz; i++) + ASSERT(big[i] == i % 123); + } + LOG("Test passed OK"); +} diff --git a/upptst/Stream64PutGet/Stream64PutGet.upp b/upptst/Stream64PutGet/Stream64PutGet.upp new file mode 100644 index 000000000..704badf30 --- /dev/null +++ b/upptst/Stream64PutGet/Stream64PutGet.upp @@ -0,0 +1,9 @@ +uses + Core; + +file + Stream64PutGet.cpp; + +mainconfig + "" = "SSE2"; + diff --git a/upptst/Stream64PutGet/init b/upptst/Stream64PutGet/init new file mode 100644 index 000000000..d6a3a9c8c --- /dev/null +++ b/upptst/Stream64PutGet/init @@ -0,0 +1,4 @@ +#ifndef _Stream64PutGet_icpp_init_stub +#define _Stream64PutGet_icpp_init_stub +#include "Core/init" +#endif