From b59e9959ed7f8fb2f29496d482c4c63dd00e8446 Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 11 Feb 2013 12:08:19 +0000 Subject: [PATCH] .upptst git-svn-id: svn://ultimatepp.org/upp/trunk@5792 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- upptst/SortedIndex/SortedIndex.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/upptst/SortedIndex/SortedIndex.cpp b/upptst/SortedIndex/SortedIndex.cpp index 7783186ba..d4c403df9 100644 --- a/upptst/SortedIndex/SortedIndex.cpp +++ b/upptst/SortedIndex/SortedIndex.cpp @@ -7,9 +7,22 @@ CONSOLE_APP_MAIN StdLogSetup(LOG_FILE|LOG_COUT); // SeedRandom(); + SortedIndex si0; + for(int i = 0; i < 10000; i++) { + int v = Random(100); + int q = si0.FindAdd(v); + ASSERT(si0[q] == v); + } + for(int i = 0; i < 100; i++) { + int q = si0.FindAdd(i); + } + ASSERT(si0.GetCount() == 100); + for(int i = 0; i < 100; i++) + ASSERT(si0[i] == i); + LOG("FindAdd passed"); SortedIndex si; int count = 0; - for(int i = 0; i < 100000000; i++) { + for(int i = 0; i < 1000000; i++) { if(i % 1000 == 0) LOG(i); if(si.GetCount() > 1000 && Random(1000) == 0) {