LCOV - code coverage report
Current view: top level - dataset - astype.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 8 8 100.0 %
Date: 2024-11-24 01:48:31 Functions: 1 1 100.0 %

          Line data    Source code
       1             : // SPDX-License-Identifier: BSD-3-Clause
       2             : // Copyright (c) 2023 Scipp contributors (https://github.com/scipp)
       3             : /// @file
       4             : /// @author Jan-Lukas Wynen
       5             : 
       6             : #include "scipp/dataset/astype.h"
       7             : 
       8             : #include "scipp/variable/astype.h"
       9             : 
      10             : namespace scipp::dataset {
      11          76 : DataArray astype(const DataArray &array, const DType type,
      12             :                  const CopyPolicy copy) {
      13          76 :   auto new_data = astype(array.data(), type, copy);
      14          75 :   auto new_masks = new_data.is_same(array.data())
      15           1 :                        ? array.masks()
      16          76 :                        : dataset::copy(array.masks());
      17         225 :   return DataArray(std::move(new_data), array.coords(), std::move(new_masks),
      18         375 :                    array.attrs(), array.name());
      19          75 : }
      20             : } // namespace scipp::dataset

Generated by: LCOV version 1.14