bslsort.cpp 1.0 KB
Newer Older
W
wangguibao 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
/***************************************************************************
 * 
 * Copyright (c) 2008 Baidu.com, Inc. All Rights Reserved
 * $Id: bslsort.cpp,v 1.2 2008/11/12 04:13:35 xiaowei Exp $ 
 * 
 **************************************************************************/
 
 
 
/**
 * @file bsltest.cpp
 * @author yufan(com@baidu.com)
 * @date 2008/07/31 18:53:53
 * @version $Revision: 1.2 $ 
 * @brief 
 *  
 **/


#include <stdlib.h>
#include <containers/list/bsl_list.h>
#include <yperfbench.h>
#include <list>
int main(int argc, char ** argv )
{

	pb::init_opt(argc, argv);
	int len = pb::getopt<int>("len");
	bsl::list<int> s;
	std::list<int> t;
	s.create();
	for(int i=0; i < len; i++)
	{
		int p = rand();
		t.push_front(p);
		s.push_front(p);
	}
	pb::timer time;
	s.sort();
	time.check();
#if 0
	t.sort();
	bsl::list<int>::iterator i1 = s.begin();
	for(std::list<int>::iterator i2 = t.begin();i2 != t.end();i2++)
	{
		if(*i1 != *i2)
		{
			printf("%d,%d\n", *i1, *i2);
			exit(1);
		}
		i1++;
	}
#endif
}









/* vim: set ts=4 sw=4 sts=4 tw=100 */