test_containers.cpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*************************************************************************/
  2. /* test_containers.cpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* http://www.godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
  9. /* */
  10. /* Permission is hereby granted, free of charge, to any person obtaining */
  11. /* a copy of this software and associated documentation files (the */
  12. /* "Software"), to deal in the Software without restriction, including */
  13. /* without limitation the rights to use, copy, modify, merge, publish, */
  14. /* distribute, sublicense, and/or sell copies of the Software, and to */
  15. /* permit persons to whom the Software is furnished to do so, subject to */
  16. /* the following conditions: */
  17. /* */
  18. /* The above copyright notice and this permission notice shall be */
  19. /* included in all copies or substantial portions of the Software. */
  20. /* */
  21. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  22. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  23. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  24. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  25. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  26. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  27. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  28. /*************************************************************************/
  29. #include "test_containers.h"
  30. #include "dvector.h"
  31. #include "set.h"
  32. #include "print_string.h"
  33. #include "math_funcs.h"
  34. #include "servers/visual/default_mouse_cursor.xpm"
  35. #include "variant.h"
  36. #include "list.h"
  37. #include "image.h"
  38. namespace TestContainers {
  39. MainLoop * test() {
  40. /*
  41. HashMap<int,int> int_map;
  42. for (int i=0;i<68000;i++) {
  43. int num=(int)Math::random(0,1024);
  44. int_map[i]=num;
  45. }
  46. */
  47. {
  48. // static const int size = 16;
  49. Image img;
  50. img.create(default_mouse_cursor_xpm);
  51. {
  52. for (int i=0; i<8; i++) {
  53. Image mipmap;
  54. //img.make_mipmap(mipmap);
  55. img = mipmap;
  56. if (img.get_width() <= 4) break;
  57. };
  58. };
  59. };
  60. #if 0
  61. Set<int> set;
  62. print_line("Begin Insert");
  63. for (int i=0;i<1100;i++) {
  64. int num=i;//(int)Math::random(0,1024);
  65. // print_line("inserting "+itos(num));
  66. set.insert( num );
  67. }
  68. /*
  69. for (int i=0;i<400;i++) {
  70. int num=(int)Math::random(0,1024);
  71. set.erase(num);
  72. }
  73. */
  74. //set.print_tree();
  75. for(Set<int>::Element *I=set.front();I;I=I->next()) {
  76. print_line("inserted "+itos(I->get())+" prev is "+itos(I->prev()?I->prev()->get():-100));
  77. }
  78. print_line("depth is "+itos(set.calculate_depth()));
  79. print_line("Insert Success");
  80. #endif
  81. return NULL;
  82. }
  83. }