test.cpp 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #include "libbinom/include/binom.h"
  2. #include "libbinom/include/lexer.h"
  3. #include <fstream>
  4. //#include "tests/multithreading_test.h"
  5. int main() {
  6. // BinOM project namespace (all magic here)
  7. using namespace binom;
  8. DynamicStorage ds("test", vobj{
  9. fld("test") = 0xff_ui8,
  10. fld("test_2") = 0x00_ui8,
  11. fld("array") = varr{
  12. "hello",
  13. "world"
  14. }
  15. }, true);
  16. ds.getRoot().insert(u"second_test", 0xff_ui8);
  17. std::clog << ds.getRoot() << '\n';
  18. // BufferArray a = "Hello, World";
  19. // BufferArray b = ui32arr{/*0x6c6c6548, 0x57202c6f, */0x646c726f};
  20. // std::cout << "a: " << a << "\nb: " << b << '\n';
  21. // auto it = a.findValue(b);
  22. // std::cout << "find value: ";
  23. // for(auto end = a.end();it != end;++it)
  24. // std::cout << it->asI8();
  25. // std::cout << "\nfind memory: ";
  26. // it = a.findMemory(b);
  27. // for(auto end = a.end();it != end;++it)
  28. // std::cout << it->asI8();
  29. // std::cout << '\n';
  30. // a = ui32arr{0x6c6c6548, 0x57202c6f, 0x646c726f};
  31. // b = "World";
  32. // std::cout << "a: " << a << "\nb: " << b << '\n';
  33. // it = a.findValue(b);
  34. // std::cout << "find value: ";
  35. // for(auto end = a.end();it != end;++it)
  36. // std::cout << it->asI8();
  37. // std::cout << "\nfind memory: ";
  38. // it = a.findMemory(b);
  39. // for(auto end = a.end();it != end;++it)
  40. // std::cout << it->asI8();
  41. // std::cout << '\n';
  42. // Variable test = varr{
  43. // "file.txt",
  44. // "file.png",
  45. // "file.cpp",
  46. // "file.hpp",
  47. // "file.binom",
  48. // "file.binomdb"
  49. // };
  50. // {
  51. // NodeVisitor node = test;
  52. // // Query - O(n)
  53. // std::clog << "-=- RAM storage\n";
  54. // std::clog << "Find in:\n" << test << "\nby value regexp: ([a-z]+)\\.binom([a-z]*)\nResult:\n";
  55. // for(auto& node : node.findSet({{QProp::value, QOper::reg_test, "([a-z]+)\\.binom([a-z]*)"}}))
  56. // std::clog << node->toRAMVisitor().getVariable() << '\n';
  57. // std::clog << "Find in:\n" << test << "\nby check contains in value: \"pp\"\nResult:\n";
  58. // for(auto& node : node.findSet({{QProp::value, QOper::contains_values, "pp"}}))
  59. // std::clog << node->toRAMVisitor().getVariable() << '\n';
  60. // }
  61. // DynamicStorage storage("test.db", test, true);
  62. // {
  63. // FileNodeVisitor node = storage;
  64. // std::clog << "\n\n-=- File storage\n";
  65. // std::clog << "Find in:\n" << test << "\nby value regexp: ([a-z]+)\\.binom([a-z]*)\nResult:\n";
  66. // for(auto& node : node.findSet({{QProp::value, QOper::reg_test, "([a-z]+)\\.binom([a-z]*)"}}))
  67. // std::clog << node->toFileVisitor().getVariable() << '\n';
  68. // std::clog << "Find in:\n" << test << "\nby check contains in value: \"pp\"\nResult:\n";
  69. // for(auto& node : node.findSet({{QProp::value, QOper::contains_values, "pp"}}))
  70. // std::clog << node->toFileVisitor().getVariable() << '\n';
  71. // }
  72. std::clog << "===============================================\n"
  73. "| Test complete |\n"
  74. "===============================================\n";
  75. }