IdTestStack.pas 666 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. unit IdTestStack;
  2. interface
  3. uses
  4. IdTest,
  5. IdStack;
  6. type
  7. TIdTestStack = class(TIdTest)
  8. published
  9. procedure TestConversionSmallInt;
  10. end;
  11. implementation
  12. procedure TIdTestStack.TestConversionSmallInt;
  13. //the problem here is that (without the cast) smallint is being cast to int64
  14. //is smallint ever actually used as a param?
  15. var
  16. TempInt: SmallInt;
  17. begin
  18. TIdStack.IncUsage;
  19. try
  20. TempInt := 55;
  21. TempInt := GStack.HostToNetwork(Word(TempInt));
  22. TempInt := GStack.NetworkToHost(Word(TempInt));
  23. Assert(TempInt = 55);
  24. finally
  25. TIdStack.DecUsage;
  26. end;
  27. end;
  28. initialization
  29. TIdTest.RegisterTest(TIdTestStack);
  30. end.