main.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* main.cpp :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: bchanot <bchanot@42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2026/01/05 12:47:49 by bchanot #+# #+# */
  9. /* Updated: 2026/01/05 14:52:57 by bchanot ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "Serializer.hpp"
  13. int main(void) {
  14. Data ori;
  15. ori.data = 3940;
  16. uintptr_t i = Serializer::serialize(&ori);
  17. if (ori.data == i ) {
  18. std::cout << "original uintptr_t from Data == return value of serialize function." << std::endl;
  19. }
  20. std::cout << "original : " << ori.data << "; Returned : " << i << std::endl;
  21. Data *test = Serializer::deserialize(i);
  22. if (test->data == i ) {
  23. std::cout << "original uintptr_t from serialize == Data of return value of deserialize function." << std::endl;
  24. }
  25. std::cout << "original : " << i << "; returned : " << test->data << std::endl;
  26. if (ori.data == test->data)
  27. std::cout << "both Data struct pointeur are ==" << std::endl;
  28. return 0;
  29. }