Coverage Report

Created: 2026-06-08 06:47

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/quantlib/ql/time/calendars/islamicholidays.cpp
Line
Count
Source
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
/*
4
 Copyright (C) 2026 SoftSolution srl
5
6
 This file is part of QuantLib, a free-software/open-source library
7
 for financial quantitative analysts and developers - http://quantlib.org/
8
9
 QuantLib is free software: you can redistribute it and/or modify it
10
 under the terms of the QuantLib license.  You should have received a
11
 copy of the license along with this program; if not, please email
12
 <quantlib-dev@lists.sf.net>. The license is also available online at
13
 <https://www.quantlib.org/license.shtml>.
14
15
 This program is distributed in the hope that it will be useful, but WITHOUT
16
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17
 FOR A PARTICULAR PURPOSE.  See the license for more details.
18
*/
19
20
#include <ql/time/calendars/islamicholidays.hpp>
21
#include <algorithm>
22
23
namespace QuantLib {
24
25
    namespace MoonSightingMethod {
26
27
0
        bool isEidAlFitr(const Date& d) {
28
0
            static std::vector<Date> dates = {
29
0
                Date(20, March,    2026),
30
0
                Date(10, March,    2027),
31
0
                Date(27, February, 2028),
32
0
                Date(15, February, 2029),
33
0
                Date(5,  February, 2030),
34
0
                Date(25, January,  2031),
35
0
                Date(14, January,  2032),
36
0
                Date(2,  January,  2033),
37
0
                Date(23, December, 2033),
38
0
                Date(12, December, 2034),
39
0
                Date(1,  December, 2035),
40
0
                Date(19, November, 2036),
41
0
                Date(8,  November, 2037),
42
0
                Date(29, October,  2038),
43
0
                Date(19, October,  2039),
44
0
                Date(7,  October,  2040),
45
0
            };
46
0
            return std::any_of(dates.begin(), dates.end(),
47
0
                [&d](const Date& p) { return d == p; });
48
0
        }
49
50
0
        bool isEidAlAdha(const Date& d) {
51
0
            static std::vector<Date> dates = {
52
0
                Date(27, May,      2026),
53
0
                Date(17, May,      2027),
54
0
                Date(5,  May,      2028),
55
0
                Date(24, April,    2029),
56
0
                Date(13, April,    2030),
57
0
                Date(3,  April,    2031),
58
0
                Date(22, March,    2032),
59
0
                Date(11, March,    2033),
60
0
                Date(28, February, 2034),
61
0
                Date(18, February, 2035),
62
0
                Date(7,  February, 2036),
63
0
                Date(27, January,  2037),
64
0
                Date(16, January,  2038),
65
0
                Date(5,  January,  2039),
66
0
                Date(26, December, 2039),
67
0
                Date(15, December, 2040),
68
0
            };
69
0
            return std::any_of(dates.begin(), dates.end(),
70
0
                [&d](const Date& p) { return d == p; });
71
0
        }
72
73
    }
74
75
}