test-online-feature.cc 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * Copyright (c) 2022 Xiaomi Corporation (authors: Fangjun Kuang)
  3. *
  4. * See LICENSE for clarification regarding multiple authors
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. #include "gtest/gtest.h"
  19. #include "online-feature.h"
  20. namespace knf {
  21. // TEST(RecyclingVector, TestUnlimited) {
  22. // RecyclingVector v(-1);
  23. // constexpr int32_t N = 100;
  24. // for (int32_t i = 0; i != N; ++i) {
  25. // std::unique_ptr<float[]> p(new float[3]{i, i + 1, i + 2});
  26. // v.PushBack(std::move(p));
  27. // }
  28. // ASSERT_EQ(v.Size(), N);
  29. // for (int32_t i = 0; i != N; ++i) {
  30. // const float *t = v.At(i);
  31. // for (int32_t k = 0; k != 3; ++k) {
  32. // EXPECT_EQ(t[k], (i + k));
  33. // }
  34. // }
  35. // }
  36. // TEST(RecyclingVector, Testlimited) {
  37. // constexpr int32_t K = 3;
  38. // constexpr int32_t N = 10;
  39. // RecyclingVector v(K);
  40. // for (int32_t i = 0; i != N; ++i) {
  41. // std::unique_ptr<float[]> p(new float[3]{i, i + 1, i + 2});
  42. // v.PushBack(std::move(p));
  43. // }
  44. // ASSERT_EQ(v.Size(), N);
  45. // for (int32_t i = N - K; i != N; ++i) {
  46. // const float *t = v.At(i);
  47. // for (int32_t k = 0; k != 3; ++k) {
  48. // EXPECT_EQ(t[k], (i + k));
  49. // }
  50. // }
  51. // }
  52. } // namespace knf