xref: /aosp_15_r20/test/dittosuite/test/time_sampler_test.cpp (revision 6fa2df46f119dce7527f5beb2814eca0e6f886ac)
1 // Copyright (C) 2021 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //      http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include <ditto/logger.h>
16 #include <ditto/sampler.h>
17 #include <gtest/gtest.h>
18 
19 #include <unistd.h>
20 
21 namespace dittosuite {
22 
TEST(TimeSamplerTest,TimeSamplerVector)23 TEST(TimeSamplerTest, TimeSamplerVector) {
24   dittosuite::TimeSampler time_sampler;
25   int n = 5;
26   for (int i = 0; i < n; i++) {
27     time_sampler.MeasureStart();
28     time_sampler.MeasureEnd();
29   }
30   ASSERT_EQ(time_sampler.GetSamples().size(), static_cast<unsigned int>(n));
31 }
32 
33 }  // namespace dittosuite
34