[clang][extract-api] Emit "navigator" property of "name" in SymbolGraph
[llvm-project.git] / compiler-rt / lib / sanitizer_common / tests / sanitizer_vector_test.cpp
blob771319ce1f38ee6fa14fb83ce7fe6aa0b60a35d3
1 //===-- sanitizer_vector_test.cpp -----------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file is a part of *Sanitizer runtime.
11 //===----------------------------------------------------------------------===//
12 #include "sanitizer_common/sanitizer_vector.h"
13 #include "gtest/gtest.h"
15 namespace __sanitizer {
17 TEST(Vector, Basic) {
18 Vector<int> v;
19 EXPECT_EQ(v.Size(), 0u);
20 v.PushBack(42);
21 EXPECT_EQ(v.Size(), 1u);
22 EXPECT_EQ(v[0], 42);
23 v.PushBack(43);
24 EXPECT_EQ(v.Size(), 2u);
25 EXPECT_EQ(v[0], 42);
26 EXPECT_EQ(v[1], 43);
29 TEST(Vector, Stride) {
30 Vector<int> v;
31 for (int i = 0; i < 1000; i++) {
32 v.PushBack(i);
33 EXPECT_EQ(v.Size(), i + 1u);
34 EXPECT_EQ(v[i], i);
36 for (int i = 0; i < 1000; i++) {
37 EXPECT_EQ(v[i], i);
41 TEST(Vector, ResizeReduction) {
42 Vector<int> v;
43 v.PushBack(0);
44 v.PushBack(0);
45 EXPECT_EQ(v.Size(), 2u);
46 v.Resize(1);
47 EXPECT_EQ(v.Size(), 1u);
50 } // namespace __sanitizer