123456789101112131415161718192021222324252627282930313233 |
- #define _NANXING_TEST_
- #include"../STL/extend/skiplist.h"
- #include"time.h"
- void test_insert(int roll,int key_type,int level,bool control) //roll代表插入次数,key_type代表给出的key的随机数总数,control代表是否启用init
- {
- nanxing_extend::skipList<int,int> test{level};
- int random[key_type];
- if(control==1)
- {
- test.init_skip(); //启用内部随机数表
- }
- std::mt19937 rnd(std::chrono::system_clock::now().time_since_epoch().count());
- for(auto& i:random)
- {
- i=static_cast<unsigned int>(rnd());
- }
- std::chrono::high_resolution_clock::time_point tp1 = std::chrono::high_resolution_clock::now();
-
- for(int i=0;i<roll;i++)
- {
- auto get=test.insert(random[i%key_type],i);
- }
- test.insert_check();
- }
- int main()
- {
- std::function<void()> fun{std::bind(test_insert,20000000,10240,15,false)};
- nanxing_test::time_test(fun);
- }
|