LCOV - code coverage report
Current view: top level - include/pairinteraction/enums - Parity.hpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 6 6 100.0 %
Date: 2026-09-10 17:43:40 Functions: 1 1 100.0 %

          Line data    Source code
       1             : // SPDX-FileCopyrightText: 2024 PairInteraction Developers
       2             : // SPDX-License-Identifier: LGPL-3.0-or-later
       3             : 
       4             : #pragma once
       5             : 
       6             : #include <functional>
       7             : #include <iostream>
       8             : #include <stdexcept>
       9             : 
      10             : namespace pairinteraction {
      11             : enum class Parity : int { ODD = -1, EVEN = 1, UNKNOWN = 2 };
      12             : 
      13          17 : inline std::ostream &operator<<(std::ostream &os, const Parity &parity) {
      14          17 :     if (parity == Parity::ODD) {
      15           9 :         return os << "-1";
      16             :     }
      17           8 :     if (parity == Parity::EVEN) {
      18           7 :         return os << "1";
      19             :     }
      20           1 :     throw std::runtime_error("Cannot print unknown parity.");
      21             : }
      22             : } // namespace pairinteraction

Generated by: LCOV version 1.16