Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-27 07:24:24

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 // Project include(s).
0010 #include "detray/utils/sort.hpp"
0011 
0012 // Google Test include(s).
0013 #include <gtest/gtest.h>
0014 
0015 // Test sort functions
0016 GTEST_TEST(detray_utils, insertion_sort) {
0017   std::vector<double> vec = {4.1, 5., 1.2, 1.4, 9.};
0018   std::vector<double> vec_sorted = {1.2, 1.4, 4.1, 5., 9.};
0019 
0020   detray::detail::insertion_sort(vec.begin(), vec.end());
0021 
0022   ASSERT_EQ(vec, vec_sorted);
0023 }
0024 
0025 GTEST_TEST(detray_utils, selection_sort) {
0026   std::vector<double> vec = {4.1, 5., 1.2, 1.4, 9.};
0027   std::vector<double> vec_sorted = {1.2, 1.4, 4.1, 5., 9.};
0028 
0029   detray::detail::selection_sort(vec.begin(), vec.end());
0030 
0031   ASSERT_EQ(vec, vec_sorted);
0032 }