├── .github └── workflows │ ├── ci.yml │ ├── pip.yml │ └── wheels.yml ├── .gitignore ├── 3rdparty ├── code_from_boost │ ├── LICENSE_1_0.txt │ └── hash │ │ └── hash.hpp ├── date │ ├── .gitignore │ ├── .travis.yml │ ├── CMakeLists.txt │ ├── LICENSE.txt │ ├── README.md │ ├── ci │ │ └── install_cmake.sh │ ├── cmake │ │ └── dateConfig.cmake │ ├── compile_fail.sh │ ├── include │ │ └── date │ │ │ ├── chrono_io.h │ │ │ ├── date.h │ │ │ ├── ios.h │ │ │ ├── islamic.h │ │ │ ├── iso_week.h │ │ │ ├── julian.h │ │ │ ├── ptz.h │ │ │ ├── solar_hijri.h │ │ │ ├── tz.h │ │ │ └── tz_private.h │ ├── src │ │ ├── ios.mm │ │ └── tz.cpp │ ├── test │ │ ├── clock_cast_test │ │ │ ├── constexpr.pass.cpp │ │ │ ├── custom_clock.pass.cpp │ │ │ ├── deprecated.pass.cpp │ │ │ ├── local_t.pass.cpp │ │ │ ├── noncastable.pass.cpp │ │ │ ├── normal_clocks.pass.cpp │ │ │ ├── to_sys_return_int.fail.cpp │ │ │ ├── to_sys_return_reference.fail.cpp │ │ │ └── to_sys_return_utc_time.fail.cpp │ │ ├── date_test │ │ │ ├── day.pass.cpp │ │ │ ├── daypday.fail.cpp │ │ │ ├── daysmday.fail.cpp │ │ │ ├── daysmweekday.fail.cpp │ │ │ ├── detail │ │ │ │ ├── decimal_format_seconds.pass.cpp │ │ │ │ ├── static_pow10.pass.cpp │ │ │ │ └── width.pass.cpp │ │ │ ├── durations.pass.cpp │ │ │ ├── durations_output.pass.cpp │ │ │ ├── format │ │ │ │ ├── century.pass.cpp │ │ │ │ ├── misc.pass.cpp │ │ │ │ ├── range.pass.cpp │ │ │ │ └── two_dight_year.pass.cpp │ │ │ ├── last.pass.cpp │ │ │ ├── make_time.pass.cpp │ │ │ ├── month.pass.cpp │ │ │ ├── month_day.pass.cpp │ │ │ ├── month_day_last.pass.cpp │ │ │ ├── month_weekday.pass.cpp │ │ │ ├── month_weekday_last.pass.cpp │ │ │ ├── month_weekday_last_less.fail.cpp │ │ │ ├── month_weekday_less.fail.cpp │ │ │ ├── monthpmonth.fail.cpp │ │ │ ├── months_m_year_month.fail.cpp │ │ │ ├── months_m_year_month_day.fail.cpp │ │ │ ├── monthsmmonth.fail.cpp │ │ │ ├── multi_year_duration_addition.pass.cpp │ │ │ ├── op_div_day_day.fail.cpp │ │ │ ├── op_div_int_month.fail.cpp │ │ │ ├── op_div_int_year.fail.cpp │ │ │ ├── op_div_last_last.fail.cpp │ │ │ ├── op_div_month_day.pass.cpp │ │ │ ├── op_div_month_day_last.pass.cpp │ │ │ ├── op_div_month_day_month_day.fail.cpp │ │ │ ├── op_div_month_month.fail.cpp │ │ │ ├── op_div_month_weekday.pass.cpp │ │ │ ├── op_div_month_weekday_last.pass.cpp │ │ │ ├── op_div_month_year.fail.cpp │ │ │ ├── op_div_survey.pass.cpp │ │ │ ├── op_div_weekday_indexed_weekday_indexed.fail.cpp │ │ │ ├── op_div_weekday_last_weekday_last.fail.cpp │ │ │ ├── op_div_year_month.pass.cpp │ │ │ ├── op_div_year_month_day.pass.cpp │ │ │ ├── op_div_year_month_day_last.pass.cpp │ │ │ ├── op_div_year_month_weekday.pass.cpp │ │ │ ├── op_div_year_month_weekday_last.pass.cpp │ │ │ ├── op_div_year_month_year_month.fail.cpp │ │ │ ├── op_div_year_year.fail.cpp │ │ │ ├── parse.pass.cpp │ │ │ ├── sizeof.pass.cpp │ │ │ ├── time_of_day_hours.pass.cpp │ │ │ ├── time_of_day_microfortnights.pass.cpp │ │ │ ├── time_of_day_milliseconds.pass.cpp │ │ │ ├── time_of_day_minutes.pass.cpp │ │ │ ├── time_of_day_nanoseconds.pass.cpp │ │ │ ├── time_of_day_seconds.pass.cpp │ │ │ ├── weekday.pass.cpp │ │ │ ├── weekday_indexed.pass.cpp │ │ │ ├── weekday_last.pass.cpp │ │ │ ├── weekday_lessthan.fail.cpp │ │ │ ├── weekday_sum.fail.cpp │ │ │ ├── year.pass.cpp │ │ │ ├── year_month.pass.cpp │ │ │ ├── year_month_day.pass.cpp │ │ │ ├── year_month_day_last.pass.cpp │ │ │ ├── year_month_day_m_year_month_day.fail.cpp │ │ │ ├── year_month_day_p_year_month_day.fail.cpp │ │ │ ├── year_month_p_year_month.fail.cpp │ │ │ ├── year_month_weekday.pass.cpp │ │ │ ├── year_month_weekday_last.pass.cpp │ │ │ ├── year_p_year.fail.cpp │ │ │ ├── years_m_year.fail.cpp │ │ │ ├── years_m_year_month.fail.cpp │ │ │ └── years_m_year_month_day.fail.cpp │ │ ├── iso_week │ │ │ ├── last.pass.cpp │ │ │ ├── lastweek_weekday.pass.cpp │ │ │ ├── op_div_survey.pass.cpp │ │ │ ├── weekday.pass.cpp │ │ │ ├── weekday_lessthan.fail.cpp │ │ │ ├── weekday_sum.fail.cpp │ │ │ ├── weeknum.pass.cpp │ │ │ ├── weeknum_p_weeknum.fail.cpp │ │ │ ├── weeknum_weekday.pass.cpp │ │ │ ├── year.pass.cpp │ │ │ ├── year_lastweek.pass.cpp │ │ │ ├── year_lastweek_weekday.pass.cpp │ │ │ ├── year_p_year.fail.cpp │ │ │ ├── year_weeknum.pass.cpp │ │ │ ├── year_weeknum_weekday.pass.cpp │ │ │ └── years_m_year.fail.cpp │ │ ├── just.pass.cpp │ │ ├── solar_hijri_test │ │ │ ├── parse.pass.cpp │ │ │ └── year_month_day.pass.cpp │ │ ├── testit │ │ └── tz_test │ │ │ ├── OffsetZone.h │ │ │ ├── OffsetZone.pass.cpp │ │ │ ├── README.md │ │ │ ├── validate.cpp │ │ │ ├── zone.pass.cpp │ │ │ ├── zoned_time.pass.cpp │ │ │ └── zoned_time_deduction.pass.cpp │ ├── test_fail.sh │ └── wcjohns_readme.txt ├── inja │ └── inja.hpp ├── nlohmann │ ├── LICENSE.MIT │ └── json.hpp └── rapidxml │ ├── license.txt │ ├── manual.html │ ├── rapidxml.hpp │ ├── rapidxml.sized_strs.hpp │ ├── rapidxml_iterators.hpp │ ├── rapidxml_print.hpp │ └── rapidxml_utils.hpp ├── CMakeLists.txt ├── LICENSE.txt ├── README.md ├── SpecUtils ├── CubicSpline.h ├── D3SpectrumExport.h ├── D3SpectrumExportResources.h.in ├── DateTime.h ├── EnergyCalibration.h ├── Filesystem.h ├── ParseUtils.h ├── RapidXmlUtils.hpp ├── SerialToDetectorModel.h ├── SpecFile.h ├── SpecFile_location.h ├── SpecUtilsAsync.h ├── SpecUtils_config.h.in ├── StringAlgo.h └── UriSpectrum.h ├── bindings ├── c │ ├── SpecUtils_c.cpp │ └── SpecUtils_c.h ├── node │ ├── CMakeLists.txt │ ├── README.md │ ├── SpecUtilsJS.cpp │ ├── SpecUtilsJS.h │ ├── cmake │ │ └── ConfigureMsvc.txt │ ├── example.js │ └── package.json ├── python │ ├── CMakeLists.txt │ ├── README.md │ ├── SpecFile_py.cpp │ ├── __init__.py │ ├── examples │ │ ├── make_file_example.py │ │ ├── make_html_plot.py │ │ ├── passthrough.n42 │ │ └── test_python.py │ ├── pyproject.toml │ └── tests │ │ ├── __init__.py │ │ └── test_specutils.py └── swig │ ├── README.md │ ├── SpecUtils.i │ └── java_example │ ├── HowToCreateJavaWrappersForC++Code.txt │ ├── LICENSE_Apache.txt │ ├── LICENSE_LGPG3.txt │ ├── Main.java │ ├── NOTICE.txt │ ├── jcommon-1.0.21.jar │ ├── jfreechart-1.0.17.jar │ ├── joda-time-2.9.jar │ └── readme.txt ├── d3_resources ├── README.txt ├── SpectrumChartD3.css ├── SpectrumChartD3.js ├── d3.v3.min.js ├── example_json_input.html ├── example_json_input.json ├── example_json_with_peaks.json └── index.html ├── examples ├── CMakeLists.txt ├── c_interface_example.c ├── convert_to_cnf.cpp ├── convert_to_n42.cpp └── d3_chart_example │ ├── README.md │ ├── json_example │ ├── SpectrumChartD3.css │ ├── SpectrumChartD3.js │ ├── c.min.js │ ├── d3.v3.min.js │ ├── example_json_input.html │ └── example_json_input.json │ └── self_contained_example.html ├── fuzz_test ├── CMakeLists.txt ├── README.md ├── file_parse_fuzz.cpp ├── fuzz_interface.cpp ├── fuzz_interface.h ├── fuzz_str_utils.cpp └── run_one_file_parse.cpp ├── regression_test ├── CMakeLists.txt └── regression_test.cpp ├── src ├── CubicSpline.cpp ├── D3SpectrumExport.cpp ├── DateTime.cpp ├── EnergyCalibration.cpp ├── Filesystem.cpp ├── ParseUtils.cpp ├── SerialToDetectorModel.cpp ├── SpecFile.cpp ├── SpecFile_aram.cpp ├── SpecFile_chn.cpp ├── SpecFile_cnf.cpp ├── SpecFile_csv.cpp ├── SpecFile_gr135.cpp ├── SpecFile_json.cpp ├── SpecFile_lis.cpp ├── SpecFile_location.cpp ├── SpecFile_lsrm.cpp ├── SpecFile_lzs.cpp ├── SpecFile_mca.cpp ├── SpecFile_mps.cpp ├── SpecFile_multiact.cpp ├── SpecFile_n42.cpp ├── SpecFile_pcf.cpp ├── SpecFile_phd.cpp ├── SpecFile_radiacode.cpp ├── SpecFile_spc.cpp ├── SpecFile_spe.cpp ├── SpecFile_spmdf.cpp ├── SpecFile_template.cpp ├── SpecFile_tka.cpp ├── SpecFile_uraider.cpp ├── SpecFile_uri.cpp ├── SpecFile_xml_other.cpp ├── SpecUtilsAsync.cpp ├── StringAlgo.cpp └── UriSpectrum.cpp └── unit_tests ├── CMakeLists.txt ├── test_c_interface.cpp ├── test_cubic_spline.cpp ├── test_data ├── datetimes.txt ├── schema │ └── n42.xsd └── txt │ ├── test_string_functions_input.txt │ └── test_string_functions_output.txt ├── test_energy_calibration.cpp ├── test_filesystem_functions.cpp ├── test_hash.cpp ├── test_iso_time_string.cpp ├── test_rebin_by_lower_energy.cpp ├── test_safe_get_line.cpp ├── test_spec_file_open.cpp ├── test_split_to_floats_and_ints.cpp ├── test_string_functions.cpp ├── test_time_from_string.cpp ├── test_uri_spectrum.cpp ├── test_utf8_limit_str_size.cpp └── test_utf8_str_len.cpp /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | build-and-test: 13 | name: Build and Test on ${{ matrix.os }} 14 | runs-on: ${{ matrix.os }} 15 | strategy: 16 | matrix: 17 | os: [ubuntu-latest, macos-latest, windows-latest] 18 | include: 19 | - os: ubuntu-latest 20 | num-parse-method: boost 21 | - os: ubuntu-latest 22 | num-parse-method: FastFloat 23 | - os: ubuntu-latest 24 | num-parse-method: FromChars 25 | - os: ubuntu-latest 26 | num-parse-method: strtod 27 | - os: macos-latest 28 | num-parse-method: FastFloat 29 | - os: windows-latest 30 | num-parse-method: FromChars 31 | - os: windows-latest 32 | num-parse-method: strtod 33 | 34 | steps: 35 | - name: Checkout code 36 | uses: actions/checkout@v2 37 | 38 | - name: Set up CMake 39 | uses: jwlawson/actions-setup-cmake@v2.0.2 40 | with: 41 | cmake-version: '3.25' 42 | 43 | # For linux, we will perform developer checks, so we need boost 44 | - name: Set up dependencies 45 | if: runner.os == 'Linux' 46 | run: sudo apt-get update && sudo apt-get install -y build-essential libboost-all-dev 47 | 48 | - name: Create build directory 49 | run: mkdir build 50 | 51 | - name: Configure CMake on Windows 52 | if: runner.os == 'Windows' 53 | run: cmake -S ${{ github.workspace }} -B build -DSpecUtils_BUILD_UNIT_TESTS=ON -DSpecUtils_BUILD_REGRESSION_TEST=ON -DSpecUtils_ENABLE_EQUALITY_CHECKS=ON -DPERFORM_DEVELOPER_CHECKS=OFF -DSpecUtils_ENABLE_D3_CHART=ON -DSpecUtils_D3_SUPPORT_FILE_STATIC=ON -DSpecUtils_ENABLE_URI_SPECTRA=OFF -DCMAKE_BUILD_TYPE=Release -DSpecUtils_FLT_PARSE_METHOD=${{ matrix.num-parse-method }} -DSpecUtils_FETCH_FAST_FLOAT=ON 54 | 55 | # On linux we will perform developer checks and compile as debug to catch asserts 56 | - name: Configure CMake on Linux 57 | if: runner.os == 'Linux' 58 | run: cmake -S ${{ github.workspace }} -B build -DSpecUtils_BUILD_UNIT_TESTS=ON -DSpecUtils_BUILD_REGRESSION_TEST=ON -DSpecUtils_ENABLE_EQUALITY_CHECKS=ON -DPERFORM_DEVELOPER_CHECKS=ON -DSpecUtils_ENABLE_D3_CHART=ON -DSpecUtils_D3_SUPPORT_FILE_STATIC=ON -DSpecUtils_ENABLE_URI_SPECTRA=ON -DCMAKE_BUILD_TYPE=Release -DSpecUtils_FLT_PARSE_METHOD=${{ matrix.num-parse-method }} -DSpecUtils_FETCH_FAST_FLOAT=ON 59 | 60 | - name: Configure CMake on macOS 61 | if: runner.os == 'macOS' 62 | run: cmake -S ${{ github.workspace }} -B build -DSpecUtils_BUILD_UNIT_TESTS=ON -DSpecUtils_BUILD_REGRESSION_TEST=ON -DSpecUtils_ENABLE_EQUALITY_CHECKS=ON -DPERFORM_DEVELOPER_CHECKS=OFF -DSpecUtils_ENABLE_D3_CHART=ON -DSpecUtils_D3_SUPPORT_FILE_STATIC=ON -DSpecUtils_ENABLE_URI_SPECTRA=ON -DCMAKE_BUILD_TYPE=Release -DSpecUtils_FLT_PARSE_METHOD=${{ matrix.num-parse-method }} -DSpecUtils_FETCH_FAST_FLOAT=ON 63 | 64 | - name: Build macOS and Windows 65 | if: runner.os != 'Linux' 66 | run: cmake --build build --config Release 67 | 68 | - name: Build Linux 69 | if: runner.os == 'Linux' 70 | run: cmake --build build --config Debug 71 | 72 | - name: Run tests 73 | run: ctest --test-dir build -C Release 74 | -------------------------------------------------------------------------------- /.github/workflows/pip.yml: -------------------------------------------------------------------------------- 1 | # From https://github.com/wjakob/nanobind_example/blob/5ce5ce57143a469e92d9ebaee9c47949ee77caa8/.github/workflows/pip.yml 2 | name: Pip 3 | 4 | on: 5 | workflow_dispatch: 6 | pull_request: 7 | push: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | build: 13 | name: Build with Pip 14 | runs-on: ${{ matrix.platform }} 15 | strategy: 16 | fail-fast: false 17 | matrix: 18 | platform: [windows-latest, macos-latest, ubuntu-latest] 19 | #python-version: ["3.9", "3.12"] 20 | python-version: ["3.12"] 21 | 22 | steps: 23 | - uses: actions/checkout@v4 24 | 25 | - uses: actions/setup-python@v5 26 | with: 27 | python-version: ${{ matrix.python-version }} 28 | 29 | - name: Set min macOS version 30 | if: runner.os == 'macOS' 31 | run: | 32 | echo "MACOSX_DEPLOYMENT_TARGET=10.14" >> $GITHUB_ENV 33 | 34 | - name: Build and install 35 | run: | 36 | python -m pip install pytest 37 | pip install --verbose ./bindings/python 38 | 39 | - name: Test 40 | run: python -m unittest discover ./bindings/python/tests 41 | -------------------------------------------------------------------------------- /.github/workflows/wheels.yml: -------------------------------------------------------------------------------- 1 | # From https://github.com/wjakob/nanobind_example/blob/5ce5ce57143a469e92d9ebaee9c47949ee77caa8/.github/workflows/wheels.yml 2 | 3 | name: Wheels 4 | 5 | on: 6 | workflow_dispatch: 7 | pull_request: 8 | push: 9 | branches: 10 | - master 11 | release: 12 | types: 13 | - published 14 | 15 | jobs: 16 | build_sdist: 17 | name: Build SDist 18 | runs-on: ubuntu-latest 19 | steps: 20 | - uses: actions/checkout@v4 21 | with: 22 | submodules: true 23 | 24 | - name: Build SDist 25 | run: pipx run build --sdist ./bindings/python 26 | 27 | - name: Check metadata 28 | run: pipx run twine check ./bindings/python/dist/* 29 | 30 | - uses: actions/upload-artifact@v4 31 | with: 32 | name: dist-sdist 33 | path: dist/*.tar.gz 34 | 35 | 36 | build_wheels: 37 | name: Wheels on ${{ matrix.os }} 38 | runs-on: ${{ matrix.os }} 39 | strategy: 40 | fail-fast: false 41 | matrix: 42 | os: [ubuntu-latest, macos-13, macos-14, macos-latest, windows-latest] 43 | 44 | steps: 45 | - uses: actions/checkout@v4 46 | with: 47 | submodules: true 48 | 49 | - uses: pypa/cibuildwheel@v2.22 50 | env: 51 | CIBW_ARCHS_MACOS: "universal2" 52 | with: 53 | package-dir: ./bindings/python 54 | 55 | - name: Verify clean directory 56 | run: git diff --exit-code 57 | shell: bash 58 | 59 | - name: Upload wheels 60 | uses: actions/upload-artifact@v4 61 | with: 62 | path: wheelhouse/*.whl 63 | name: dist-${{ matrix.os }} 64 | 65 | upload_all: 66 | name: Upload if release 67 | needs: [build_wheels, build_sdist] 68 | runs-on: ubuntu-latest 69 | environment: 70 | name: pypi 71 | url: https://pypi.org/p/SandiaSpecUtils 72 | permissions: 73 | id-token: write # IMPORTANT: this permission is mandatory for trusted publishing 74 | if: github.event_name == 'release' && github.event.action == 'published' 75 | 76 | steps: 77 | - uses: actions/setup-python@v5 78 | - uses: actions/download-artifact@v4 79 | with: 80 | pattern: dist-* 81 | merge-multiple: true 82 | - shell: bash 83 | run: | 84 | pwd 85 | ls 86 | 87 | - uses: pypa/gh-action-pypi-publish@release/v1 88 | with: 89 | packages-dir: /home/runner/work/SpecUtils/SpecUtils 90 | user: __token__ 91 | password: ${{ secrets.pypi_password }} 92 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *OUO* 2 | .svn 3 | .vscode 4 | .idea 5 | .DS_Store 6 | .cproject 7 | .project 8 | .svnignore 9 | XcodeFiles 10 | build 11 | build_* 12 | documentation 13 | testing 14 | README.txt 15 | *.tmp 16 | *.zip 17 | *.tgz 18 | *.bz2 19 | *.log 20 | *.json 21 | CMakeLists.txt.user 22 | CMakeCache.txt 23 | cmake_install.cmake 24 | install_manifest.txt 25 | .vs/ 26 | out/ -------------------------------------------------------------------------------- /3rdparty/code_from_boost/LICENSE_1_0.txt: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /3rdparty/date/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The source code in this project is released using the MIT License. There is no 2 | global license for the project because each file is licensed individually with 3 | different author names and/or dates. 4 | 5 | If you contribute to this project, please add your name to the license of each 6 | file you modify. If you have already contributed to this project and forgot to 7 | add your name to the license, please feel free to submit a new P/R to add your 8 | name to the license in each file you modified. 9 | 10 | For convenience, here is a copy of the MIT license found in each file except 11 | without author names or dates: 12 | 13 | The MIT License (MIT) 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | -------------------------------------------------------------------------------- /3rdparty/date/README.md: -------------------------------------------------------------------------------- 1 | # Date 2 | 3 | [![Build Status](https://travis-ci.org/HowardHinnant/date.svg?branch=master)](https://travis-ci.org/HowardHinnant/date) 4 | [![Join the chat at https://gitter.im/HowardHinnant/date](https://badges.gitter.im/HowardHinnant/date.svg)](https://gitter.im/HowardHinnant/date?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 5 | 6 | --- 7 | 8 | **[Try it out on wandbox!](https://wandbox.org/permlink/L8MwjzSSC3fXXrMd)** 9 | 10 | ## Summary 11 | 12 | This is actually several separate C++11/C++14/C++17 libraries: 13 | 14 | 1. `"date.h"` is a header-only library which builds upon ``. It adds some new `duration` types, and new `time_point` types. It also adds "field" types such as `year_month_day` which is a struct `{year, month, day}`. And it provides convenient means to convert between the "field" types and the `time_point` types. 15 | 16 | * Documentation: http://howardhinnant.github.io/date/date.html 17 | * Video: https://www.youtube.com/watch?v=tzyGjOm8AKo 18 | * Slides: http://schd.ws/hosted_files/cppcon2015/43/hinnant_dates.pdf 19 | 20 | 1. `"tz.h"` / `"tz.cpp"` are a timezone library built on top of the `"date.h"` library. This timezone library is a complete parser of the IANA timezone database. It provides for an easy way to access all of the data in this database, using the types from `"date.h"` and ``. The IANA database also includes data on leap seconds, and this library provides utilities to compute with that information as well. 21 | 22 | * Documentation: http://howardhinnant.github.io/date/tz.html 23 | * Video: https://www.youtube.com/watch?v=Vwd3pduVGKY 24 | * Slides: http://schd.ws/hosted_files/cppcon2016/0f/Welcome%20To%20The%20Time%20Zone%20-%20Howard%20Hinnant%20-%20CppCon%202016.pdf 25 | 26 | 1. `"iso_week.h"` is a header-only library built on top of the `"date.h"` library which implements the ISO week date calendar. 27 | 28 | * Documentation: http://howardhinnant.github.io/date/iso_week.html 29 | 30 | 1. `"julian.h"` is a header-only library built on top of the `"date.h"` library which implements a proleptic Julian calendar which is fully interoperable with everything above. 31 | 32 | * Documentation: http://howardhinnant.github.io/date/julian.html 33 | 34 | 1. `"islamic.h"` is a header-only library built on top of the `"date.h"` library which implements a proleptic Islamic calendar which is fully interoperable with everything above. 35 | 36 | * Documentation: http://howardhinnant.github.io/date/islamic.html 37 | 38 | ## Standardization 39 | 40 | Slightly modified versions of `"date.h"` and `"tz.h"` were voted into the C++20 working draft at the Jacksonville FL meeting on 2018-03-17: 41 | 42 | * http://howardhinnant.github.io/date/d0355r7.html 43 | 44 | ## Build & Test 45 | 46 | You can download and install Date using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager: 47 | 48 | git clone https://github.com/Microsoft/vcpkg.git 49 | cd vcpkg 50 | ./bootstrap-vcpkg.sh 51 | ./vcpkg integrate install 52 | vcpkg install date 53 | 54 | The Date port in vcpkg is updated by Microsoft team members and community contributors. If the version falls behind, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. 55 | 56 | You can optionally build using [CMake](https://cmake.org/). Here is a guide of how to build and test using the CMake Makefile generator. 57 | 58 | ```bash 59 | mkdir build 60 | cd build 61 | cmake ../ 62 | cmake --build . --target testit # Consider '-- -j4' for multithreading 63 | ``` 64 | ## Projects using this library 65 | 66 | * www.safe.com 67 | * www.webtoolkit.eu/wt 68 | * https://github.com/ViewTouch/viewtouch 69 | * https://routinghub.com 70 | * https://github.com/valhalla 71 | 72 | If you would like your project (or product) on this list, just let me know. 73 | -------------------------------------------------------------------------------- /3rdparty/date/ci/install_cmake.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | IFS=. read cm_maj cm_min cm_rel <<<"$1" 5 | : ${cm_rel:-0} 6 | CMAKE_ROOT=${2:-"${HOME}/cmake"} 7 | 8 | function cmake_version () 9 | { 10 | if [[ -d ${CMAKE_ROOT} ]] ; then 11 | local perms=$(test $(uname) = "Linux" && echo "/111" || echo "+111") 12 | local installed=$(find ${CMAKE_ROOT} -perm ${perms} -type f -name cmake) 13 | if [[ "${installed}" != "" ]] ; then 14 | echo "$(${installed} --version | head -1)" 15 | fi 16 | fi 17 | } 18 | 19 | installed=$(cmake_version) 20 | if [[ "${installed}" != "" && ${installed} =~ ${cm_maj}.${cm_min}.${cm_rel} ]] ; then 21 | echo "cmake already installed: ${installed}" 22 | exit 23 | fi 24 | 25 | pkgname="cmake-${cm_maj}.${cm_min}.${cm_rel}-$(uname)-x86_64.tar.gz" 26 | tmppkg="/tmp/cmake.tar.gz" 27 | wget --quiet https://cmake.org/files/v${cm_maj}.${cm_min}/${pkgname} -O ${tmppkg} 28 | mkdir -p ${CMAKE_ROOT} 29 | cd ${CMAKE_ROOT} 30 | tar --strip-components 1 -xf ${tmppkg} 31 | rm -f ${tmppkg} 32 | echo "installed: $(cmake_version)" 33 | 34 | 35 | -------------------------------------------------------------------------------- /3rdparty/date/cmake/dateConfig.cmake: -------------------------------------------------------------------------------- 1 | include( CMakeFindDependencyMacro ) 2 | include( "${CMAKE_CURRENT_LIST_DIR}/dateTargets.cmake" ) 3 | if( NOT MSVC AND TARGET date::tz ) 4 | find_dependency( Threads REQUIRED) 5 | get_target_property( _tzill date::tz INTERFACE_LINK_LIBRARIES ) 6 | if( _tzill AND "${_tzill}" MATCHES "libcurl" ) 7 | find_dependency( CURL ) 8 | endif( ) 9 | endif( ) 10 | 11 | 12 | -------------------------------------------------------------------------------- /3rdparty/date/compile_fail.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export TEST_BIN_NAME=$1 3 | #echo "Building ${TEST_BIN_NAME}" 4 | shift 1 5 | export BUILD_COMMAND=$@ 6 | #echo "Build command: ${BUILD_COMMAND}" 7 | eval ${BUILD_COMMAND} >/dev/null 2>/dev/null 8 | 9 | if [ $? -eq 0 ]; then 10 | echo -ne "#!/bin/bash\nexit 1;" > ${TEST_BIN_NAME} 11 | else 12 | echo -ne "#!/bin/bash\nexit 0;" > ${TEST_BIN_NAME} 13 | fi 14 | chmod u+x ${TEST_BIN_NAME} 15 | exit 0; 16 | 17 | -------------------------------------------------------------------------------- /3rdparty/date/include/date/chrono_io.h: -------------------------------------------------------------------------------- 1 | #ifndef CHRONO_IO_H 2 | #define CHRONO_IO_H 3 | 4 | // The MIT License (MIT) 5 | // 6 | // Copyright (c) 2016, 2017 Howard Hinnant 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in all 16 | // copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | // SOFTWARE. 25 | // 26 | // Our apologies. When the previous paragraph was written, lowercase had not yet 27 | // been invented (that would involve another several millennia of evolution). 28 | // We did not mean to shout. 29 | 30 | // This functionality has moved to "date.h" 31 | 32 | #include "date.h" 33 | 34 | #endif // CHRONO_IO_H 35 | -------------------------------------------------------------------------------- /3rdparty/date/include/date/ios.h: -------------------------------------------------------------------------------- 1 | // 2 | // ios.h 3 | // DateTimeLib 4 | // 5 | // The MIT License (MIT) 6 | // 7 | // Copyright (c) 2016 Alexander Kormanovsky 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in all 17 | // copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | // SOFTWARE. 26 | 27 | #ifndef ios_hpp 28 | #define ios_hpp 29 | 30 | #if __APPLE__ 31 | # include 32 | # if TARGET_OS_IPHONE 33 | # include 34 | 35 | namespace date 36 | { 37 | namespace iOSUtils 38 | { 39 | 40 | std::string get_tzdata_path(); 41 | std::string get_current_timezone(); 42 | 43 | } // namespace iOSUtils 44 | } // namespace date 45 | 46 | # endif // TARGET_OS_IPHONE 47 | #else // !__APPLE__ 48 | # define TARGET_OS_IPHONE 0 49 | #endif // !__APPLE__ 50 | #endif // ios_hpp 51 | -------------------------------------------------------------------------------- /3rdparty/date/test/clock_cast_test/constexpr.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2019 nanoric 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #include "tz.h" 24 | #include 25 | #include 26 | 27 | struct const_clock { 28 | using duration = 29 | typename std::common_type::type; 31 | using rep = duration::rep; 32 | using period = duration::period; 33 | using time_point = std::chrono::time_point; 34 | 35 | static constexpr date::sys_days epoch { date::days { 1000 } }; 36 | 37 | template 38 | static std::chrono::time_point::type> 40 | CONSTCD11 to_sys(std::chrono::time_point const& tp) 41 | { 42 | return epoch + tp.time_since_epoch(); 43 | } 44 | 45 | template 46 | static std::chrono::time_point::type> 48 | CONSTCD11 from_sys( 49 | std::chrono::time_point const& 50 | tp) 51 | { 52 | using res = std::chrono::time_point::type>; 54 | return res(tp - epoch); 55 | } 56 | }; 57 | 58 | int main() 59 | { 60 | using namespace date; 61 | using namespace std::chrono; 62 | using const_days = time_point; 63 | 64 | CONSTCD14 sys_days sys { days { 1024 } }; 65 | static_assert(sys.time_since_epoch().count() == 1024, ""); 66 | 67 | CONSTCD14 const_days c {clock_cast(sys)}; 68 | CONSTCD14 sys_days sys2 {clock_cast(c)}; 69 | CONSTCD14 sys_days sys3 { clock_cast(const_days(days(48))) }; 70 | #if __cplusplus >= 201402L 71 | static_assert(c.time_since_epoch().count() == 24, ""); 72 | static_assert(sys2.time_since_epoch().count() == 1024, ""); 73 | static_assert(sys3.time_since_epoch().count() == 1048, ""); 74 | #endif 75 | } 76 | -------------------------------------------------------------------------------- /3rdparty/date/test/clock_cast_test/deprecated.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2017 Tomasz Kamiński 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #include "tz.h" 24 | #include 25 | 26 | int 27 | main() 28 | { 29 | using namespace date; 30 | 31 | // sys <-> utc 32 | { 33 | sys_days st(1997_y/dec/12); 34 | auto ut = utc_clock::from_sys(st); 35 | 36 | assert(to_utc_time(st) == ut); 37 | assert(to_sys_time(ut) == st); 38 | } 39 | 40 | // tai <-> utc 41 | { 42 | sys_days st(1997_y/dec/12); 43 | auto ut = utc_clock::from_sys(st); 44 | auto tt = tai_clock::from_utc(ut); 45 | 46 | assert(to_tai_time(ut) == tt); 47 | assert(to_utc_time(tt) == ut); 48 | } 49 | 50 | // tai <-> sys 51 | { 52 | sys_days st(1997_y/dec/12); 53 | auto ut = utc_clock::from_sys(st); 54 | auto tt = tai_clock::from_utc(ut); 55 | 56 | assert(to_tai_time(st) == tt); 57 | assert(to_sys_time(tt) == st); 58 | } 59 | 60 | // gps <-> utc 61 | { 62 | sys_days st(1997_y/dec/12); 63 | auto ut = utc_clock::from_sys(st); 64 | auto gt = gps_clock::from_utc(ut); 65 | 66 | assert(to_gps_time(ut) == gt); 67 | assert(to_utc_time(gt) == ut); 68 | } 69 | 70 | // gps <-> sys 71 | { 72 | sys_days st(1997_y/dec/12); 73 | auto ut = utc_clock::from_sys(st); 74 | auto gt = gps_clock::from_utc(ut); 75 | 76 | assert(to_gps_time(st) == gt); 77 | assert(to_sys_time(gt) == st); 78 | } 79 | 80 | // tai <-> gps 81 | { 82 | sys_days st(1997_y/dec/12); 83 | auto ut = utc_clock::from_sys(st); 84 | auto tt = tai_clock::from_utc(ut); 85 | auto gt = gps_clock::from_utc(ut); 86 | 87 | assert(to_gps_time(tt) == gt); 88 | assert(to_tai_time(gt) == tt); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /3rdparty/date/test/clock_cast_test/normal_clocks.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2017 Tomasz Kamiński 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #include "tz.h" 24 | #include 25 | 26 | int 27 | main() 28 | { 29 | using namespace date; 30 | using sys_clock = std::chrono::system_clock; 31 | 32 | // self 33 | { 34 | sys_days st(1997_y/dec/12); 35 | auto ut = utc_clock::from_sys(st); 36 | auto tt = tai_clock::from_utc(ut); 37 | 38 | assert(clock_cast(st) == st); 39 | assert(clock_cast(ut) == ut); 40 | assert(clock_cast(tt) == tt); 41 | } 42 | 43 | // sys <-> utc 44 | { 45 | sys_days st(1997_y/dec/12); 46 | auto ut = utc_clock::from_sys(st); 47 | 48 | assert(clock_cast(st) == ut); 49 | assert(clock_cast(ut) == st); 50 | } 51 | 52 | // tai <-> utc 53 | { 54 | sys_days st(1997_y/dec/12); 55 | auto ut = utc_clock::from_sys(st); 56 | auto tt = tai_clock::from_utc(ut); 57 | 58 | assert(clock_cast(ut) == tt); 59 | assert(clock_cast(tt) == ut); 60 | } 61 | 62 | // tai <-> sys 63 | { 64 | sys_days st(1997_y/dec/12); 65 | auto ut = utc_clock::from_sys(st); 66 | auto tt = tai_clock::from_utc(ut); 67 | 68 | assert(clock_cast(st) == tt); 69 | assert(clock_cast(tt) == st); 70 | } 71 | 72 | // gps <-> utc 73 | { 74 | sys_days st(1997_y/dec/12); 75 | auto ut = utc_clock::from_sys(st); 76 | auto gt = gps_clock::from_utc(ut); 77 | 78 | assert(clock_cast(ut) == gt); 79 | assert(clock_cast(gt) == ut); 80 | } 81 | 82 | // gps <-> sys 83 | { 84 | sys_days st(1997_y/dec/12); 85 | auto ut = utc_clock::from_sys(st); 86 | auto gt = gps_clock::from_utc(ut); 87 | 88 | assert(clock_cast(st) == gt); 89 | assert(clock_cast(gt) == st); 90 | } 91 | 92 | // tai <-> gps 93 | { 94 | sys_days st(1997_y/dec/12); 95 | auto ut = utc_clock::from_sys(st); 96 | auto tt = tai_clock::from_utc(ut); 97 | auto gt = gps_clock::from_utc(ut); 98 | 99 | assert(clock_cast(tt) == gt); 100 | assert(clock_cast(gt) == tt); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /3rdparty/date/test/clock_cast_test/to_sys_return_int.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2017 Tomasz Kamiński 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #include "tz.h" 24 | 25 | struct bad_clock 26 | { 27 | using duration = std::chrono::system_clock::duration; 28 | using rep = duration::rep; 29 | using period = duration::period; 30 | using time_point = std::chrono::time_point; 31 | 32 | template 33 | static 34 | int 35 | to_sys(std::chrono::time_point const& tp) 36 | { 37 | return tp.time_since_epoch().count(); 38 | } 39 | }; 40 | 41 | int 42 | main() 43 | { 44 | using namespace date; 45 | using sys_clock = std::chrono::system_clock; 46 | 47 | auto bt = bad_clock::time_point(); 48 | clock_cast(bt); 49 | } 50 | -------------------------------------------------------------------------------- /3rdparty/date/test/clock_cast_test/to_sys_return_reference.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2017 Tomasz Kamiński 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #include "tz.h" 24 | 25 | struct bad_clock 26 | { 27 | using duration = std::chrono::system_clock::duration; 28 | using rep = duration::rep; 29 | using period = duration::period; 30 | using time_point = std::chrono::time_point; 31 | 32 | template 33 | static 34 | date::sys_time const& 35 | to_sys(std::chrono::time_point const& tp) 36 | { 37 | static date::sys_time val; 38 | val = date::sys_time(tp.time_since_epoch()); 39 | return val; 40 | } 41 | }; 42 | 43 | int 44 | main() 45 | { 46 | using namespace date; 47 | using sys_clock = std::chrono::system_clock; 48 | 49 | auto bt = bad_clock::time_point(); 50 | clock_cast(bt); 51 | } 52 | -------------------------------------------------------------------------------- /3rdparty/date/test/clock_cast_test/to_sys_return_utc_time.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2017, 2018 Tomasz Kamiński 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #include "tz.h" 24 | 25 | struct bad_clock 26 | { 27 | using duration = std::chrono::system_clock::duration; 28 | using rep = duration::rep; 29 | using period = duration::period; 30 | using time_point = std::chrono::time_point; 31 | 32 | template 33 | static 34 | date::utc_time 35 | to_sys(std::chrono::time_point const& tp) 36 | { 37 | return date::utc_time(tp.time_since_epoch()); 38 | } 39 | }; 40 | 41 | int 42 | main() 43 | { 44 | using namespace date; 45 | using sys_clock = std::chrono::system_clock; 46 | 47 | auto bt = bad_clock::time_point(); 48 | clock_cast(bt); 49 | } 50 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/daypday.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // day + day not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | auto x = 3_d + 7_d; 32 | } 33 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/daysmday.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // days - day not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | auto x = days{3} - 7_d; 32 | } 33 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/daysmweekday.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // days - weekday not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | auto b = days{1} - sun; 32 | } 33 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/detail/static_pow10.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2017 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // template 24 | // struct static_pow10 25 | // { 26 | // static constepxr std::uint64_t value = ...; 27 | // }; 28 | 29 | #include "date.h" 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | int 36 | main() 37 | { 38 | using namespace date::detail; 39 | static_assert(static_pow10<0>::value == 1, ""); 40 | static_assert(static_pow10<1>::value == 10, ""); 41 | static_assert(static_pow10<2>::value == 100, ""); 42 | static_assert(static_pow10<3>::value == 1000, ""); 43 | static_assert(static_pow10<4>::value == 10000, ""); 44 | static_assert(static_pow10<5>::value == 100000, ""); 45 | static_assert(static_pow10<6>::value == 1000000, ""); 46 | static_assert(static_pow10<7>::value == 10000000, ""); 47 | static_assert(static_pow10<8>::value == 100000000, ""); 48 | static_assert(static_pow10<9>::value == 1000000000, ""); 49 | static_assert(static_pow10<10>::value == 10000000000, ""); 50 | } 51 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/detail/width.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2017 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // width::value is the number of fractional decimal digits in 1/n 24 | // width<0>::value and width<1>::value are defined to be 0 25 | // If 1/n takes more than 18 fractional decimal digits, 26 | // the result is truncated to 19. 27 | // Example: width<2>::value == 1 28 | // Example: width<3>::value == 19 29 | // Example: width<4>::value == 2 30 | // Example: width<10>::value == 1 31 | // Example: width<1000>::value == 3 32 | // template 33 | // 34 | // struct width 35 | // { 36 | // static constexpr unsigned value = ...; 37 | // }; 38 | 39 | #include "date.h" 40 | 41 | #include 42 | #include 43 | #include 44 | 45 | int 46 | main() 47 | { 48 | using namespace date::detail; 49 | static_assert(width<0>::value == 0, ""); 50 | static_assert(width<1>::value == 0, ""); 51 | static_assert(width<2>::value == 1, ""); 52 | static_assert(width<3>::value == 19, ""); 53 | static_assert(width<4>::value == 2, ""); 54 | static_assert(width<5>::value == 1, ""); 55 | static_assert(width<6>::value == 19, ""); 56 | static_assert(width<7>::value == 19, ""); 57 | static_assert(width<8>::value == 3, ""); 58 | static_assert(width<9>::value == 19, ""); 59 | static_assert(width<10>::value == 1, ""); 60 | static_assert(width<100>::value == 2, ""); 61 | static_assert(width<1000>::value == 3, ""); 62 | static_assert(width<10000>::value == 4, ""); 63 | static_assert(width<625>::value == 4, ""); 64 | } 65 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/durations.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // durations 24 | // 25 | // using days = std::chrono::duration 26 | // , std::chrono::hours::period>>; 27 | // 28 | // using weeks = std::chrono::duration 29 | // , days::period>>; 30 | // 31 | // using years = std::chrono::duration 32 | // , days::period>>; 33 | // 34 | // using months = std::chrono::duration 35 | // >>; 36 | // 37 | // time_point 38 | // 39 | // using sys_days = std::chrono::time_point; 40 | 41 | #include "date.h" 42 | 43 | #include 44 | 45 | static_assert(date::days{1} == std::chrono::hours{24}, ""); 46 | 47 | static_assert(date::weeks{1} == date::days{7}, ""); 48 | 49 | static_assert(date::months{12} == date::years{1}, ""); 50 | static_assert(date::days{30} < date::months{1} && date::months{1} < date::days{31}, ""); 51 | static_assert(date::weeks{4} < date::months{1} && date::months{1} < date::weeks{5}, ""); 52 | 53 | static_assert(date::years{400} == date::days{146097}, ""); 54 | static_assert(date::days{365} < date::years{1} && date::years{1} < date::days{366}, ""); 55 | static_assert(date::weeks{52} < date::years{1} && date::years{1} < date::weeks{53}, ""); 56 | 57 | static_assert(std::is_same{}, ""); 58 | 59 | int 60 | main() 61 | { 62 | } 63 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/format/century.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #include "date.h" 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | int 30 | main() 31 | { 32 | using namespace date; 33 | using namespace std::chrono; 34 | std::ostringstream os; 35 | os << format("%C", sys_days{jun/1/20001}); 36 | assert(os.str() == "200"); 37 | 38 | os.str(""); 39 | os << format("%C", sys_days{jun/1/20000}); 40 | assert(os.str() == "200"); 41 | 42 | os.str(""); 43 | os << format("%C", sys_days{jun/1/19999}); 44 | assert(os.str() == "199"); 45 | 46 | os.str(""); 47 | os << format("%C", sys_days{jun/1/2001}); 48 | assert(os.str() == "20"); 49 | 50 | os.str(""); 51 | os << format("%C", sys_days{jun/1/2000}); 52 | assert(os.str() == "20"); 53 | 54 | os.str(""); 55 | os << format("%C", sys_days{jun/1/1999}); 56 | assert(os.str() == "19"); 57 | 58 | os.str(""); 59 | os << format("%C", sys_days{jun/1/101}); 60 | assert(os.str() == "01"); 61 | 62 | os.str(""); 63 | os << format("%C", sys_days{jun/1/100}); 64 | assert(os.str() == "01"); 65 | 66 | os.str(""); 67 | os << format("%C", sys_days{jun/1/99}); 68 | assert(os.str() == "00"); 69 | 70 | os.str(""); 71 | os << format("%C", sys_days{jun/1/1}); 72 | assert(os.str() == "00"); 73 | 74 | os.str(""); 75 | os << format("%C", sys_days{jun/1/0}); 76 | assert(os.str() == "00"); 77 | 78 | os.str(""); 79 | os << format("%C", sys_days{jun/1/-1}); 80 | assert(os.str() == "-01"); 81 | 82 | os.str(""); 83 | os << format("%C", sys_days{jun/1/-99}); 84 | assert(os.str() == "-01"); 85 | 86 | os.str(""); 87 | os << format("%C", sys_days{jun/1/-100}); 88 | assert(os.str() == "-01"); 89 | 90 | os.str(""); 91 | os << format("%C", sys_days{jun/1/-101}); 92 | assert(os.str() == "-02"); 93 | 94 | os.str(""); 95 | os << format("%C", sys_days{jun/1/-1999}); 96 | assert(os.str() == "-20"); 97 | 98 | os.str(""); 99 | os << format("%C", sys_days{jun/1/-2000}); 100 | assert(os.str() == "-20"); 101 | 102 | os.str(""); 103 | os << format("%C", sys_days{jun/1/-2001}); 104 | assert(os.str() == "-21"); 105 | 106 | os.str(""); 107 | os << format("%C", sys_days{jun/1/-19999}); 108 | assert(os.str() == "-200"); 109 | 110 | os.str(""); 111 | os << format("%C", sys_days{jun/1/-20000}); 112 | assert(os.str() == "-200"); 113 | 114 | os.str(""); 115 | os << format("%C", sys_days{jun/1/-20001}); 116 | assert(os.str() == "-201"); 117 | } 118 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/format/misc.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #include "date.h" 24 | #include 25 | #include 26 | 27 | template 28 | void 29 | test(const std::string& in_fmt, const std::string& input, 30 | const std::string& out_fmt, const std::string& output) 31 | { 32 | using namespace date; 33 | std::istringstream in{input}; 34 | T t; 35 | in >> parse(in_fmt, t); 36 | assert(!in.fail()); 37 | auto s = format(out_fmt, t); 38 | assert(s == output); 39 | } 40 | 41 | int 42 | main() 43 | { 44 | using namespace date; 45 | test("%Y", "2017", "%Y", "2017"); 46 | test("%m", "3", "%m", "03"); 47 | test("%d", "25", "%d", "25"); 48 | test("%Y-%m", "2017-03", "%Y-%m", "2017-03"); 49 | test("%y%m", "1703", "%Y-%m", "2017-03"); 50 | test("%m/%d", "3/25", "%m/%d", "03/25"); 51 | test("%w", "3", "%w", "3"); 52 | } 53 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/format/range.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #include "date.h" 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | using fortnights = std::chrono::duration, 31 | date::weeks::period>>; 32 | 33 | using microfortnights = std::chrono::duration>; 36 | 37 | int 38 | main() 39 | { 40 | using namespace date; 41 | using namespace std::chrono; 42 | std::ostringstream os; 43 | os << format("%F %T", sys_days{jan/1/year::min()}); 44 | assert(os.str() == "-32767-01-01 00:00:00"); 45 | os.str(""); 46 | os << format("%F %T", sys_days{dec/last/year::max()}); 47 | assert(os.str() == "32767-12-31 00:00:00"); 48 | os.str(""); 49 | os << format("%F %T", sys_days{dec/last/year::max()} + hours{23} + minutes{59} + 50 | seconds{59} + microseconds{999999}); 51 | assert(os.str() == "32767-12-31 23:59:59.999999"); 52 | os.str(""); 53 | 54 | os << format("%Y-%m-%d %H:%M:%S", sys_days{jan/1/year::min()}); 55 | assert(os.str() == "-32767-01-01 00:00:00"); 56 | os.str(""); 57 | os << format("%Y-%m-%d %H:%M:%S", sys_days{dec/last/year::max()}); 58 | assert(os.str() == "32767-12-31 00:00:00"); 59 | os.str(""); 60 | os << format("%Y-%m-%d %H:%M:%S", sys_days{dec/last/year::max()} + hours{23} + 61 | minutes{59} + seconds{59} + microseconds{999999}); 62 | assert(os.str() == "32767-12-31 23:59:59.999999"); 63 | os.str(""); 64 | 65 | os << format("%F %T", sys_days{jan/1/year::min()} + microfortnights{1}); 66 | assert(os.str() == "-32767-01-01 00:00:01.2096"); 67 | os.str(""); 68 | os << format("%F %T", sys_days{dec/last/year::max()} + microfortnights{1}); 69 | assert(os.str() == "32767-12-31 00:00:01.2096"); 70 | os.str(""); 71 | 72 | os << format("%F", jan/1/year::min()); 73 | assert(os.str() == "-32767-01-01"); 74 | os.str(""); 75 | os << format("%F", dec/last/year::max()); 76 | assert(os.str() == "32767-12-31"); 77 | os.str(""); 78 | } 79 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/last.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // constexpr struct last_spec {} last{}; 24 | 25 | #include "date.h" 26 | 27 | #include 28 | 29 | static_assert(std::is_same{}, ""); 30 | 31 | int 32 | main() 33 | { 34 | } 35 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/make_time.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // template ::value>::type> 26 | // constexpr 27 | // time_of_day> 28 | // make_time(std::chrono::duration d) noexcept; 29 | 30 | #include "date.h" 31 | 32 | #include 33 | #include 34 | 35 | int 36 | main() 37 | { 38 | using namespace date; 39 | using namespace std; 40 | using namespace std::chrono; 41 | 42 | { 43 | static_assert(is_same>{}, ""); 45 | auto tod = make_time(nanoseconds{18429000000022}); 46 | assert(tod.hours() == hours{5}); 47 | assert(tod.minutes() == minutes{7}); 48 | assert(tod.seconds() == seconds{9}); 49 | assert(tod.subseconds() == nanoseconds{22}); 50 | } 51 | { 52 | static_assert(is_same>{}, ""); 54 | auto tod = make_time(microseconds{18429000022}); 55 | assert(tod.hours() == hours{5}); 56 | assert(tod.minutes() == minutes{7}); 57 | assert(tod.seconds() == seconds{9}); 58 | assert(tod.subseconds() == microseconds{22}); 59 | } 60 | { 61 | static_assert(is_same>{}, ""); 63 | auto tod = make_time(seconds{18429}); 64 | assert(tod.hours() == hours{5}); 65 | assert(tod.minutes() == minutes{7}); 66 | assert(tod.seconds() == seconds{9}); 67 | } 68 | { 69 | static_assert(is_same>{}, ""); 71 | auto tod = make_time(minutes{307}); 72 | assert(tod.hours() == hours{5}); 73 | assert(tod.minutes() == minutes{7}); 74 | } 75 | { 76 | static_assert(is_same>{}, ""); 78 | auto tod = make_time(hours{5}); 79 | assert(tod.hours() == hours{5}); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/month_day.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // class month_day 24 | // { 25 | // public: 26 | // constexpr month_day(const date::month& m, const date::day& d) noexcept; 27 | // 28 | // constexpr date::month month() const noexcept; 29 | // constexpr date::day day() const noexcept; 30 | // 31 | // constexpr bool ok() const noexcept; 32 | // }; 33 | 34 | // constexpr bool operator==(const month_day& x, const month_day& y) noexcept; 35 | // constexpr bool operator!=(const month_day& x, const month_day& y) noexcept; 36 | // constexpr bool operator< (const month_day& x, const month_day& y) noexcept; 37 | // constexpr bool operator> (const month_day& x, const month_day& y) noexcept; 38 | // constexpr bool operator<=(const month_day& x, const month_day& y) noexcept; 39 | // constexpr bool operator>=(const month_day& x, const month_day& y) noexcept; 40 | 41 | // std::ostream& operator<<(std::ostream& os, const month_day& md); 42 | 43 | #include "date.h" 44 | 45 | #include 46 | #include 47 | #include 48 | 49 | static_assert( std::is_trivially_destructible{}, ""); 50 | static_assert( std::is_default_constructible{}, ""); 51 | static_assert( std::is_trivially_copy_constructible{}, ""); 52 | static_assert( std::is_trivially_copy_assignable{}, ""); 53 | static_assert( std::is_trivially_move_constructible{}, ""); 54 | static_assert( std::is_trivially_move_assignable{}, ""); 55 | 56 | static_assert(std::is_nothrow_constructible{}, ""); 58 | 59 | int 60 | main() 61 | { 62 | using namespace date; 63 | 64 | constexpr month_day md1 = {feb, day{28}}; 65 | constexpr month_day md2 = {mar, day{1}}; 66 | #if __cplusplus >= 201402 67 | static_assert(md1.ok(), ""); 68 | static_assert(md2.ok(), ""); 69 | static_assert(!month_day{feb, day{32}}.ok(), ""); 70 | static_assert(!month_day{month{0}, day{1}}.ok(), ""); 71 | #endif 72 | static_assert(md1.month() == feb, ""); 73 | static_assert(md1.day() == day{28}, ""); 74 | static_assert(md2.month() == mar, ""); 75 | static_assert(md2.day() == day{1}, ""); 76 | static_assert(md1 == md1, ""); 77 | static_assert(md1 != md2, ""); 78 | static_assert(md1 < md2, ""); 79 | std::ostringstream os; 80 | os << md1; 81 | assert(os.str() == "Feb/28"); 82 | } 83 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/month_day_last.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // class month_day_last 24 | // { 25 | // public: 26 | // constexpr explicit month_day_last(const date::month& m) noexcept; 27 | // 28 | // constexpr date::month month() const noexcept; 29 | // constexpr bool ok() const noexcept; 30 | // }; 31 | 32 | // constexpr bool operator==(const month_day_last& x, const month_day_last& y) noexcept; 33 | // constexpr bool operator!=(const month_day_last& x, const month_day_last& y) noexcept; 34 | // constexpr bool operator< (const month_day_last& x, const month_day_last& y) noexcept; 35 | // constexpr bool operator> (const month_day_last& x, const month_day_last& y) noexcept; 36 | // constexpr bool operator<=(const month_day_last& x, const month_day_last& y) noexcept; 37 | // constexpr bool operator>=(const month_day_last& x, const month_day_last& y) noexcept; 38 | 39 | // std::ostream& operator<<(std::ostream& os, const month_day_last& mdl); 40 | 41 | #include "date.h" 42 | 43 | #include 44 | #include 45 | #include 46 | 47 | static_assert( std::is_trivially_destructible{}, ""); 48 | static_assert(!std::is_default_constructible{}, ""); 49 | static_assert( std::is_trivially_copy_constructible{}, ""); 50 | static_assert( std::is_trivially_copy_assignable{}, ""); 51 | static_assert( std::is_trivially_move_constructible{}, ""); 52 | static_assert( std::is_trivially_move_assignable{}, ""); 53 | 54 | static_assert(std::is_nothrow_constructible{}, ""); 55 | static_assert(!std::is_convertible{}, ""); 56 | 57 | int 58 | main() 59 | { 60 | using namespace date; 61 | 62 | constexpr month_day_last mdl1{feb}; 63 | constexpr month_day_last mdl2{mar}; 64 | static_assert(mdl1.ok(), ""); 65 | static_assert(mdl2.ok(), ""); 66 | static_assert(!month_day_last{month{0}}.ok(), ""); 67 | static_assert(mdl1.month() == feb, ""); 68 | static_assert(mdl2.month() == mar, ""); 69 | static_assert(mdl1 == mdl1, ""); 70 | static_assert(mdl1 != mdl2, ""); 71 | static_assert(mdl1 < mdl2, ""); 72 | std::ostringstream os; 73 | os << mdl1; 74 | assert(os.str() == "Feb/last"); 75 | } 76 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/month_weekday.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // class month_weekday 24 | // { 25 | // public: 26 | // constexpr month_weekday(const date::month& m, 27 | // const date::weekday_indexed& wdi) noexcept; 28 | // 29 | // constexpr date::month month() const noexcept; 30 | // constexpr date::weekday_indexed weekday_indexed() const noexcept; 31 | // 32 | // constexpr bool ok() const noexcept; 33 | // }; 34 | 35 | // constexpr bool operator==(const month_weekday& x, const month_weekday& y) noexcept; 36 | // constexpr bool operator!=(const month_weekday& x, const month_weekday& y) noexcept; 37 | 38 | // std::ostream& operator<<(std::ostream& os, const month_weekday& mwd); 39 | 40 | #include "date.h" 41 | 42 | #include 43 | #include 44 | #include 45 | 46 | static_assert( std::is_trivially_destructible{}, ""); 47 | static_assert(!std::is_default_constructible{}, ""); 48 | static_assert( std::is_trivially_copy_constructible{}, ""); 49 | static_assert( std::is_trivially_copy_assignable{}, ""); 50 | static_assert( std::is_trivially_move_constructible{}, ""); 51 | static_assert( std::is_trivially_move_assignable{}, ""); 52 | 53 | static_assert(std::is_nothrow_constructible{}, ""); 56 | 57 | int 58 | main() 59 | { 60 | using namespace date; 61 | 62 | constexpr month_weekday mwd1 = {feb, sat[4]}; 63 | constexpr month_weekday mwd2 = {mar, mon[1]}; 64 | static_assert(mwd1.ok(), ""); 65 | static_assert(mwd2.ok(), ""); 66 | static_assert(!month_weekday{feb, sat[0]}.ok(), ""); 67 | static_assert(!month_weekday{month{0}, sun[1]}.ok(), ""); 68 | static_assert(mwd1.month() == feb, ""); 69 | static_assert(mwd1.weekday_indexed() == sat[4], ""); 70 | static_assert(mwd2.month() == mar, ""); 71 | static_assert(mwd2.weekday_indexed() == mon[1], ""); 72 | static_assert(mwd1 == mwd1, ""); 73 | static_assert(mwd1 != mwd2, ""); 74 | std::ostringstream os; 75 | os << mwd1; 76 | assert(os.str() == "Feb/Sat[4]"); 77 | } 78 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/month_weekday_last.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // class month_weekday_last 24 | // { 25 | // public: 26 | // constexpr month_weekday_last(const date::month& m, 27 | // const date::weekday_last& wdl) noexcept; 28 | // 29 | // constexpr date::month month() const noexcept; 30 | // constexpr date::weekday_last weekday_last() const noexcept; 31 | // 32 | // constexpr bool ok() const noexcept; 33 | // }; 34 | 35 | // constexpr 36 | // bool operator==(const month_weekday_last& x, const month_weekday_last& y) noexcept; 37 | // constexpr 38 | // bool operator!=(const month_weekday_last& x, const month_weekday_last& y) noexcept; 39 | 40 | // std::ostream& operator<<(std::ostream& os, const month_weekday_last& mwdl); 41 | 42 | #include "date.h" 43 | 44 | #include 45 | #include 46 | #include 47 | 48 | static_assert( std::is_trivially_destructible{}, ""); 49 | static_assert(!std::is_default_constructible{}, ""); 50 | static_assert( std::is_trivially_copy_constructible{}, ""); 51 | static_assert( std::is_trivially_copy_assignable{}, ""); 52 | static_assert( std::is_trivially_move_constructible{}, ""); 53 | static_assert( std::is_trivially_move_assignable{}, ""); 54 | 55 | static_assert(std::is_nothrow_constructible{}, ""); 57 | 58 | int 59 | main() 60 | { 61 | using namespace date; 62 | 63 | constexpr month_weekday_last mwdl1 = {feb, sat[last]}; 64 | constexpr month_weekday_last mwdl2 = {mar, mon[last]}; 65 | static_assert(mwdl1.ok(), ""); 66 | static_assert(mwdl2.ok(), ""); 67 | static_assert(!month_weekday_last{month{0}, sun[last]}.ok(), ""); 68 | static_assert(mwdl1.month() == feb, ""); 69 | static_assert(mwdl1.weekday_last() == sat[last], ""); 70 | static_assert(mwdl2.month() == mar, ""); 71 | static_assert(mwdl2.weekday_last() == mon[last], ""); 72 | static_assert(mwdl1 == mwdl1, ""); 73 | static_assert(mwdl1 != mwdl2, ""); 74 | std::ostringstream os; 75 | os << mwdl1; 76 | assert(os.str() == "Feb/Sat[last]"); 77 | } 78 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/month_weekday_last_less.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // month_weekday_last < month_weekday_last not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | month_weekday_last mwdl1 = {feb, sat[last]}; 32 | month_weekday_last mwdl2 = {mar, mon[last]}; 33 | auto b = mwdl1 < mwdl2; 34 | } 35 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/month_weekday_less.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // month_weekday < month_weekday not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | month_weekday mwd1 = {feb, sat[4]}; 32 | month_weekday mwd2 = {mar, mon[1]}; 33 | auto b = mwd1 < mwd2; 34 | } 35 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/monthpmonth.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // month + month not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | auto x = mar + jul; 32 | } 33 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/months_m_year_month.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // months - year_month not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | 32 | auto x = months{1} - year_month{2015_y, jan}; 33 | } 34 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/months_m_year_month_day.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // months - year_month_day not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | 32 | auto x = jan - year_month_day{2015_y, aug, 9_d}; 33 | } 34 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/monthsmmonth.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // months - month not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | auto x = months{3} - jul; 32 | } 33 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/op_div_day_day.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // day / day not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | 32 | auto x = 14_d/14_d; 33 | } 34 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/op_div_int_month.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // int / month not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | 32 | auto x = 8/aug; 33 | } 34 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/op_div_int_year.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // int / year not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | 32 | auto x = 8/2015_y; 33 | } 34 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/op_div_last_last.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // last / last not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | 32 | auto x = last/last; 33 | } 34 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/op_div_month_day.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // constexpr month_day operator/(const month& m, const day& d) noexcept; 24 | // constexpr month_day operator/(const month& m, int d) noexcept; 25 | // constexpr month_day operator/(int m, const day& d) noexcept; 26 | // constexpr month_day operator/(const day& d, const month& m) noexcept; 27 | // constexpr month_day operator/(const day& d, int m) noexcept; 28 | 29 | #include "date.h" 30 | 31 | int 32 | main() 33 | { 34 | using namespace date; 35 | 36 | static_assert( aug/14_d == month_day{month{8}, day{14}}, ""); 37 | static_assert( aug/14 == month_day{month{8}, day{14}}, ""); 38 | static_assert( 8/14_d == month_day{month{8}, day{14}}, ""); 39 | static_assert(14_d/aug == month_day{month{8}, day{14}}, ""); 40 | static_assert(14_d/8 == month_day{month{8}, day{14}}, ""); 41 | } 42 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/op_div_month_day_last.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // constexpr month_day_last operator/(const month& m, last_spec) noexcept; 24 | // constexpr month_day_last operator/(int m, last_spec) noexcept; 25 | // constexpr month_day_last operator/(last_spec, const month& m) noexcept; 26 | // constexpr month_day_last operator/(last_spec, int m) noexcept; 27 | 28 | #include "date.h" 29 | 30 | int 31 | main() 32 | { 33 | using namespace date; 34 | 35 | static_assert( aug/last == month_day_last{month{8}}, ""); 36 | static_assert( 8/last == month_day_last{month{8}}, ""); 37 | static_assert(last/aug == month_day_last{month{8}}, ""); 38 | static_assert(last/8 == month_day_last{month{8}}, ""); 39 | } 40 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/op_div_month_day_month_day.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // month_day / month_day not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | 32 | auto x = (aug/14_d)/(aug/14_d); 33 | } 34 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/op_div_month_month.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // month / month not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | 32 | auto x = aug/aug; 33 | } 34 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/op_div_month_weekday.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // constexpr month_weekday operator/(const month& m, const weekday_indexed& wdi) noexcept; 24 | // constexpr month_weekday operator/(int m, const weekday_indexed& wdi) noexcept; 25 | // constexpr month_weekday operator/(const weekday_indexed& wdi, const month& m) noexcept; 26 | // constexpr month_weekday operator/(const weekday_indexed& wdi, int m) noexcept; 27 | 28 | #include "date.h" 29 | 30 | int 31 | main() 32 | { 33 | using namespace date; 34 | 35 | static_assert( aug/fri[2] == month_weekday{month{8}, weekday_indexed{weekday{5u}, 2}}, ""); 36 | static_assert( 8/fri[2] == month_weekday{month{8}, weekday_indexed{weekday{5u}, 2}}, ""); 37 | static_assert(fri[2]/aug == month_weekday{month{8}, weekday_indexed{weekday{5u}, 2}}, ""); 38 | static_assert(fri[2]/8 == month_weekday{month{8}, weekday_indexed{weekday{5u}, 2}}, ""); 39 | } 40 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/op_div_month_weekday_last.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // constexpr month_weekday_last operator/(const month& m, const weekday_last& wdl) noexcept; 24 | // constexpr month_weekday_last operator/(int m, const weekday_last& wdl) noexcept; 25 | // constexpr month_weekday_last operator/(const weekday_last& wdl, const month& m) noexcept; 26 | // constexpr month_weekday_last operator/(const weekday_last& wdl, int m) noexcept; 27 | 28 | #include "date.h" 29 | 30 | int 31 | main() 32 | { 33 | using namespace date; 34 | 35 | static_assert( aug/fri[last] == month_weekday_last{month{8}, weekday_last{weekday{5u}}}, ""); 36 | static_assert( 8/fri[last] == month_weekday_last{month{8}, weekday_last{weekday{5u}}}, ""); 37 | static_assert(fri[last]/aug == month_weekday_last{month{8}, weekday_last{weekday{5u}}}, ""); 38 | static_assert(fri[last]/8 == month_weekday_last{month{8}, weekday_last{weekday{5u}}}, ""); 39 | } 40 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/op_div_month_year.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // month / year not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | 32 | auto x = aug/2015_y; 33 | } 34 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/op_div_weekday_indexed_weekday_indexed.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // weekday_indexed / weekday_indexed not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | 32 | auto x = fri[2]/fri[2]; 33 | } 34 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/op_div_weekday_last_weekday_last.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // weekday_last / weekday_last not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | 32 | auto x = fri[last]/fri[last]; 33 | } 34 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/op_div_year_month.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // constexpr year_month operator/(const year& y, const month& m) noexcept; 24 | // constexpr year_month operator/(const year& y, int m) noexcept; 25 | 26 | #include "date.h" 27 | 28 | int 29 | main() 30 | { 31 | using namespace date; 32 | 33 | static_assert(2015_y/aug == year_month{year{2015}, aug}, ""); 34 | static_assert(2015_y/8 == year_month{year{2015}, aug}, ""); 35 | } 36 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/op_div_year_month_day.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // constexpr year_month_day operator/(const year_month& ym, const day& d) noexcept; 24 | // constexpr year_month_day operator/(const year_month& ym, int d) noexcept; 25 | // constexpr year_month_day operator/(const year& y, const month_day& md) noexcept; 26 | // constexpr year_month_day operator/(int y, const month_day& md) noexcept; 27 | // constexpr year_month_day operator/(const month_day& md, const year& y) noexcept; 28 | // constexpr year_month_day operator/(const month_day& md, int y) noexcept; 29 | 30 | #include "date.h" 31 | 32 | int 33 | main() 34 | { 35 | using namespace date; 36 | 37 | static_assert( 2015_y/aug/14_d == year_month_day{year{2015}, month{8}, day{14}}, ""); 38 | static_assert( 2015_y/aug/14 == year_month_day{year{2015}, month{8}, day{14}}, ""); 39 | static_assert( 2015_y/(aug/14_d) == year_month_day{year{2015}, month{8}, day{14}}, ""); 40 | static_assert( 2015/(aug/14_d) == year_month_day{year{2015}, month{8}, day{14}}, ""); 41 | static_assert(aug/14_d/2015_y == year_month_day{year{2015}, month{8}, day{14}}, ""); 42 | static_assert(aug/14_d/2015 == year_month_day{year{2015}, month{8}, day{14}}, ""); 43 | } 44 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/op_div_year_month_day_last.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // constexpr year_month_day_last operator/(const year_month& ym, last_spec) noexcept; 24 | // constexpr year_month_day_last operator/(const year& y, const month_day_last& mdl) noexcept; 25 | // constexpr year_month_day_last operator/(int y, const month_day_last& mdl) noexcept; 26 | // constexpr year_month_day_last operator/(const month_day_last& mdl, const year& y) noexcept; 27 | // constexpr year_month_day_last operator/(const month_day_last& mdl, int y) noexcept; 28 | 29 | #include "date.h" 30 | 31 | int 32 | main() 33 | { 34 | using namespace date; 35 | 36 | static_assert(2015_y/aug/last == year_month_day_last{year{2015}, month_day_last{month{8}}}, ""); 37 | static_assert( 2015_y/(aug/last) == year_month_day_last{year{2015}, month_day_last{month{8}}}, ""); 38 | static_assert( 2015/(aug/last) == year_month_day_last{year{2015}, month_day_last{month{8}}}, ""); 39 | static_assert( aug/last/2015_y == year_month_day_last{year{2015}, month_day_last{month{8}}}, ""); 40 | static_assert( aug/last/2015 == year_month_day_last{year{2015}, month_day_last{month{8}}}, ""); 41 | } 42 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/op_div_year_month_weekday.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // constexpr year_month_weekday operator/(const year_month& ym, const weekday_indexed& wdi) noexcept; 24 | // constexpr year_month_weekday operator/(const year& y, const month_weekday& mwd) noexcept; 25 | // constexpr year_month_weekday operator/(int y, const month_weekday& mwd) noexcept; 26 | // constexpr year_month_weekday operator/(const month_weekday& mwd, const year& y) noexcept; 27 | // constexpr year_month_weekday operator/(const month_weekday& mwd, int y) noexcept; 28 | 29 | #include "date.h" 30 | 31 | int 32 | main() 33 | { 34 | using namespace date; 35 | 36 | static_assert(2015_y/aug/fri[2] == year_month_weekday{year{2015}, month{8}, weekday_indexed{weekday{5u}, 2}}, ""); 37 | static_assert( 2015_y/(aug/fri[2]) == year_month_weekday{year{2015}, month{8}, weekday_indexed{weekday{5u}, 2}}, ""); 38 | static_assert( 2015/(aug/fri[2]) == year_month_weekday{year{2015}, month{8}, weekday_indexed{weekday{5u}, 2}}, ""); 39 | static_assert(aug/fri[2]/2015_y == year_month_weekday{year{2015}, month{8}, weekday_indexed{weekday{5u}, 2}}, ""); 40 | static_assert(aug/fri[2]/2015 == year_month_weekday{year{2015}, month{8}, weekday_indexed{weekday{5u}, 2}}, ""); 41 | } 42 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/op_div_year_month_weekday_last.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // constexpr year_month_weekday_last operator/(const year_month& ym, const weekday_last& wdl) noexcept; 24 | // constexpr year_month_weekday_last operator/(const year& y, const month_weekday_last& mwdl) noexcept; 25 | // constexpr year_month_weekday_last operator/(int y, const month_weekday_last& mwdl) noexcept; 26 | // constexpr year_month_weekday_last operator/(const month_weekday_last& mwdl, const year& y) noexcept; 27 | // constexpr year_month_weekday_last operator/(const month_weekday_last& mwdl, int y) noexcept; 28 | 29 | #include "date.h" 30 | 31 | int 32 | main() 33 | { 34 | using namespace date; 35 | 36 | static_assert( 2015_y/aug/fri[last] == year_month_weekday_last{year{2015}, month{8}, weekday_last{weekday{5u}}}, ""); 37 | static_assert( 2015_y/(aug/fri[last]) == year_month_weekday_last{year{2015}, month{8}, weekday_last{weekday{5u}}}, ""); 38 | static_assert( 2015/(aug/fri[last]) == year_month_weekday_last{year{2015}, month{8}, weekday_last{weekday{5u}}}, ""); 39 | static_assert(aug/fri[last]/2015_y == year_month_weekday_last{year{2015}, month{8}, weekday_last{weekday{5u}}}, ""); 40 | static_assert(aug/fri[last]/2015 == year_month_weekday_last{year{2015}, month{8}, weekday_last{weekday{5u}}}, ""); 41 | } 42 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/op_div_year_month_year_month.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // year_month / year_month not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | 32 | auto x = (2015_y/aug)/(2015_y/aug); 33 | } 34 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/op_div_year_year.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // year / year not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | 32 | auto x = 2015_y/2015_y; 33 | } 34 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/sizeof.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // This test is meant to maintain a record of the sizeof each type. 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | 32 | static_assert(sizeof(days) == 4, ""); 33 | static_assert(sizeof(weeks) == 4, ""); 34 | static_assert(sizeof(months) == 4, ""); 35 | static_assert(sizeof(years) == 4, ""); 36 | 37 | static_assert(sizeof(sys_days) == 4, ""); 38 | 39 | static_assert(sizeof(last_spec) == 1, ""); 40 | 41 | static_assert(sizeof(day) == 1, ""); 42 | static_assert(sizeof(month) == 1, ""); 43 | static_assert(sizeof(year) == 2, ""); 44 | 45 | static_assert(sizeof(weekday) == 1, ""); 46 | static_assert(sizeof(weekday_indexed) == 1, ""); 47 | static_assert(sizeof(weekday_last) == 1, ""); 48 | 49 | static_assert(sizeof(month_day) == 2, ""); 50 | static_assert(sizeof(month_day_last) == 1, ""); 51 | static_assert(sizeof(month_weekday) == 2, ""); 52 | static_assert(sizeof(month_weekday_last) == 2, ""); 53 | 54 | static_assert(sizeof(year_month) == 4, ""); 55 | 56 | static_assert(sizeof(year_month_day) == 4, ""); 57 | static_assert(sizeof(year_month_day_last) == 4, ""); 58 | static_assert(sizeof(year_month_weekday) == 4, ""); 59 | static_assert(sizeof(year_month_weekday_last) == 4, ""); 60 | 61 | // sizeof time_of_day varies 62 | } 63 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/time_of_day_hours.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // enum {am = 1, pm}; 24 | 25 | // class time_of_day 26 | // { 27 | // public: 28 | // using precision = std::chrono::hours; 29 | // 30 | // constexpr explicit time_of_day(std::chrono::hours since_midnight) noexcept; 31 | // constexpr time_of_day(std::chrono::hours h, unsigned md) noexcept; 32 | // 33 | // constexpr std::chrono::hours hours() const noexcept; 34 | // constexpr unsigned mode() const noexcept; 35 | // 36 | // constexpr explicit operator precision() const noexcept; 37 | // constexpr precision to_duration() const noexcept; 38 | // 39 | // void make24() noexcept; 40 | // void make12() noexcept; 41 | // }; 42 | 43 | // std::ostream& operator<<(std::ostream& os, const time_of_day& t); 44 | 45 | #include "date.h" 46 | 47 | #include 48 | #include 49 | #include 50 | 51 | int 52 | main() 53 | { 54 | using namespace date; 55 | using namespace std; 56 | using namespace std::chrono; 57 | 58 | using tod = time_of_day; 59 | 60 | static_assert(is_same{}, ""); 61 | 62 | static_assert( is_trivially_destructible{}, ""); 63 | static_assert( is_default_constructible{}, ""); 64 | static_assert( is_trivially_copy_constructible{}, ""); 65 | static_assert( is_trivially_copy_assignable{}, ""); 66 | static_assert( is_trivially_move_constructible{}, ""); 67 | static_assert( is_trivially_move_assignable{}, ""); 68 | 69 | static_assert(is_nothrow_constructible{}, ""); 70 | static_assert(!is_convertible{}, ""); 71 | 72 | static_assert(is_nothrow_constructible{}, ""); 73 | static_assert(!is_convertible{}, ""); 74 | 75 | constexpr tod t1 = tod{hours{13}}; 76 | static_assert(t1.hours() == hours{13}, ""); 77 | #if __cplusplus >= 201402 78 | static_assert(static_cast(t1) == hours{13}, ""); 79 | static_assert(t1.to_duration() == hours{13}, ""); 80 | #endif 81 | 82 | auto t2 = t1; 83 | assert(t2.hours() == t1.hours()); 84 | assert(t2.to_duration() == t1.to_duration()); 85 | ostringstream os; 86 | os << t2; 87 | assert(os.str() == "13:00:00"); 88 | auto h = make12(t2.hours()); 89 | os.str(""); 90 | assert(h == hours{1}); 91 | assert(t2.to_duration() == t1.to_duration()); 92 | assert(!is_am(t2.hours())); 93 | assert(is_pm(t2.hours())); 94 | } 95 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/time_of_day_minutes.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // enum {am = 1, pm}; 24 | 25 | // class time_of_day 26 | // { 27 | // public: 28 | // using precision = std::chrono::minutes; 29 | // 30 | // constexpr explicit time_of_day(std::chrono::minutes since_midnight) noexcept; 31 | // constexpr time_of_day(std::chrono::hours h, std::chrono::minutes m, 32 | // unsigned md) noexcept; 33 | // 34 | // constexpr std::chrono::hours hours() const noexcept; 35 | // constexpr std::chrono::minutes minutes() const noexcept; 36 | // constexpr unsigned mode() const noexcept; 37 | // 38 | // constexpr explicit operator precision() const noexcept; 39 | // constexpr precision to_duration() const noexcept; 40 | // 41 | // void make24() noexcept; 42 | // void make12() noexcept; 43 | // }; 44 | 45 | // std::ostream& operator<<(std::ostream& os, const time_of_day& t); 46 | 47 | #include "date.h" 48 | 49 | #include 50 | #include 51 | #include 52 | 53 | int 54 | main() 55 | { 56 | using namespace date; 57 | using namespace std; 58 | using namespace std::chrono; 59 | 60 | using tod = time_of_day; 61 | 62 | static_assert(is_same{}, ""); 63 | 64 | static_assert( is_trivially_destructible{}, ""); 65 | static_assert( is_default_constructible{}, ""); 66 | static_assert( is_trivially_copy_constructible{}, ""); 67 | static_assert( is_trivially_copy_assignable{}, ""); 68 | static_assert( is_trivially_move_constructible{}, ""); 69 | static_assert( is_trivially_move_assignable{}, ""); 70 | 71 | static_assert(is_nothrow_constructible{}, ""); 72 | static_assert(!is_convertible{}, ""); 73 | 74 | static_assert(is_nothrow_constructible{}, ""); 75 | static_assert(!is_convertible{}, ""); 76 | 77 | constexpr tod t1 = tod{hours{13} + minutes{7}}; 78 | static_assert(t1.hours() == hours{13}, ""); 79 | static_assert(t1.minutes() == minutes{7}, ""); 80 | #if __cplusplus >= 201402 81 | static_assert(static_cast(t1) == hours{13} + minutes{7}, ""); 82 | static_assert(t1.to_duration() == hours{13} + minutes{7}, ""); 83 | #endif 84 | 85 | auto t2 = t1; 86 | assert(t2.hours() == t1.hours()); 87 | assert(t2.minutes() == t1.minutes()); 88 | assert(t2.to_duration() == t1.to_duration()); 89 | ostringstream os; 90 | os << t2; 91 | assert(os.str() == "13:07:00"); 92 | } 93 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/weekday_indexed.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // class weekday_indexed 24 | // { 25 | // public: 26 | // weekday_indexed() = default; 27 | // constexpr weekday_indexed(const date::weekday& wd, unsigned index) noexcept; 28 | // 29 | // constexpr date::weekday weekday() const noexcept; 30 | // constexpr unsigned index() const noexcept; 31 | // constexpr bool ok() const noexcept; 32 | // }; 33 | // 34 | // constexpr bool operator==(const weekday_indexed& x, const weekday_indexed& y) noexcept; 35 | // constexpr bool operator!=(const weekday_indexed& x, const weekday_indexed& y) noexcept; 36 | // 37 | // std::ostream& operator<<(std::ostream& os, const weekday_indexed& wdi); 38 | 39 | #include "date.h" 40 | 41 | #include 42 | #include 43 | #include 44 | 45 | static_assert( std::is_trivially_destructible{}, ""); 46 | static_assert( std::is_default_constructible{}, ""); 47 | static_assert( std::is_trivially_copy_constructible{}, ""); 48 | static_assert( std::is_trivially_copy_assignable{}, ""); 49 | static_assert( std::is_trivially_move_constructible{}, ""); 50 | static_assert( std::is_trivially_move_assignable{}, ""); 51 | 52 | static_assert(std::is_nothrow_constructible{}, ""); 54 | 55 | int 56 | main() 57 | { 58 | using namespace date; 59 | 60 | constexpr weekday_indexed wdi = sun[1]; 61 | static_assert(wdi.weekday() == sun, ""); 62 | static_assert(wdi.index() == 1, ""); 63 | static_assert(wdi.ok(), ""); 64 | static_assert(wdi == weekday_indexed{sun, 1}, ""); 65 | static_assert(wdi != weekday_indexed{sun, 2}, ""); 66 | static_assert(wdi != weekday_indexed{mon, 1}, ""); 67 | std::ostringstream os; 68 | os << wdi; 69 | assert(os.str() == "Sun[1]"); 70 | } 71 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/weekday_last.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // class weekday_last 24 | // { 25 | // public: 26 | // explicit constexpr weekday_last(const date::weekday& wd) noexcept; 27 | // 28 | // constexpr date::weekday weekday() const noexcept; 29 | // constexpr bool ok() const noexcept; 30 | // }; 31 | // 32 | // constexpr bool operator==(const weekday_last& x, const weekday_last& y) noexcept; 33 | // constexpr bool operator!=(const weekday_last& x, const weekday_last& y) noexcept; 34 | // 35 | // std::ostream& operator<<(std::ostream& os, const weekday_last& wdl); 36 | 37 | #include "date.h" 38 | 39 | #include 40 | #include 41 | #include 42 | 43 | static_assert( std::is_trivially_destructible{}, ""); 44 | static_assert(!std::is_default_constructible{}, ""); 45 | static_assert( std::is_trivially_copy_constructible{}, ""); 46 | static_assert( std::is_trivially_copy_assignable{}, ""); 47 | static_assert( std::is_trivially_move_constructible{}, ""); 48 | static_assert( std::is_trivially_move_assignable{}, ""); 49 | 50 | static_assert(std::is_nothrow_constructible{}, ""); 51 | static_assert(!std::is_convertible{}, ""); 52 | 53 | int 54 | main() 55 | { 56 | using namespace date; 57 | 58 | constexpr weekday_last wdl = sun[last]; 59 | static_assert(wdl.weekday() == sun, ""); 60 | static_assert(wdl.ok(), ""); 61 | static_assert(wdl == weekday_last{sun}, ""); 62 | static_assert(wdl != weekday_last{mon}, ""); 63 | std::ostringstream os; 64 | os << wdl; 65 | assert(os.str() == "Sun[last]"); 66 | } 67 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/weekday_lessthan.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // weekday < weekday not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | auto b = sun < mon; 32 | } 33 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/weekday_sum.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // weekday + weekday not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | auto b = sun + mon; 32 | } 33 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/year_month_day_m_year_month_day.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // year_month_day - year_month_day not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | 32 | auto x = year_month_day{2015_y, aug, 9_d} - year_month_day{2015_y, aug, 9_d}; 33 | } 34 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/year_month_day_p_year_month_day.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // year_month_day + year_month_day not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | 32 | auto x = year_month_day{2015_y, aug, 9_d} + year_month_day{2015_y, aug, 9_d}; 33 | } 34 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/year_month_p_year_month.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // year_month + year_month not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | 32 | auto x = year_month{2015_y, jan} + year_month{2015_y, jan}; 33 | } 34 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/year_p_year.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // year + year not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | auto x = 2015_y + 2015_y; 32 | } 33 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/years_m_year.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // years - year not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | auto x = years{3} - 2015_y; 32 | } 33 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/years_m_year_month.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // years - year_month not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | 32 | auto x = years{1} - year_month{2015_y, jan}; 33 | } 34 | -------------------------------------------------------------------------------- /3rdparty/date/test/date_test/years_m_year_month_day.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // years - year_month_day not allowed 24 | 25 | #include "date.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace date; 31 | 32 | auto x = 2015_y - year_month_day{2015_y, aug, 9_d}; 33 | } 34 | -------------------------------------------------------------------------------- /3rdparty/date/test/iso_week/last.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // constexpr struct last_spec {} last{}; 24 | 25 | #include "iso_week.h" 26 | 27 | #include 28 | 29 | static_assert(std::is_same{}, ""); 30 | 31 | int 32 | main() 33 | { 34 | } 35 | -------------------------------------------------------------------------------- /3rdparty/date/test/iso_week/weekday_lessthan.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // weekday < weekday not allowed 24 | 25 | #include "iso_week.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace iso_week; 31 | auto b = sun < mon; 32 | } 33 | -------------------------------------------------------------------------------- /3rdparty/date/test/iso_week/weekday_sum.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // weekday + weekday not allowed 24 | 25 | #include "iso_week.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace iso_week; 31 | auto b = sun + mon; 32 | } 33 | -------------------------------------------------------------------------------- /3rdparty/date/test/iso_week/weeknum_p_weeknum.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // weeknum + weeknum not allowed 24 | 25 | #include "iso_week.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace iso_week; 31 | auto x = 3_w + 4_w; 32 | } 33 | -------------------------------------------------------------------------------- /3rdparty/date/test/iso_week/year_p_year.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // year + year not allowed 24 | 25 | #include "iso_week.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace iso_week; 31 | auto x = 2015_y + 2015_y; 32 | } 33 | -------------------------------------------------------------------------------- /3rdparty/date/test/iso_week/years_m_year.fail.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // years - year not allowed 24 | 25 | #include "iso_week.h" 26 | 27 | int 28 | main() 29 | { 30 | using namespace iso_week; 31 | auto x = years{3} - 2015_y; 32 | } 33 | -------------------------------------------------------------------------------- /3rdparty/date/test/just.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | int 24 | main() 25 | { 26 | } 27 | -------------------------------------------------------------------------------- /3rdparty/date/test/tz_test/OffsetZone.h: -------------------------------------------------------------------------------- 1 | #ifndef OFFSET_ZONE_H 2 | #define OFFSET_ZONE_H 3 | 4 | // The MIT License (MIT) 5 | // 6 | // Copyright (c) 2017 Howard Hinnant 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in all 16 | // copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | // SOFTWARE. 25 | 26 | // Test custom time zone support 27 | 28 | #include "tz.h" 29 | 30 | class OffsetZone 31 | { 32 | std::chrono::minutes offset_; 33 | 34 | public: 35 | explicit OffsetZone(std::chrono::minutes offset) 36 | : offset_{offset} 37 | {} 38 | 39 | template 40 | auto 41 | to_local(date::sys_time tp) const 42 | { 43 | using namespace date; 44 | using namespace std::chrono; 45 | using LT = local_time>; 46 | return LT{(tp + offset_).time_since_epoch()}; 47 | } 48 | 49 | template 50 | auto 51 | to_sys(date::local_time tp, date::choose = date::choose::earliest) const 52 | { 53 | using namespace date; 54 | using namespace std::chrono; 55 | using ST = sys_time>; 56 | return ST{(tp - offset_).time_since_epoch()}; 57 | } 58 | 59 | template 60 | date::sys_info 61 | get_info(date::sys_time st) const 62 | { 63 | using namespace date; 64 | using namespace std::chrono; 65 | return {sys_seconds::min(), sys_seconds::max(), offset_, 66 | minutes{0}, offset_ >= minutes{0} ? "+" + date::format("%H%M", offset_) 67 | : "-" + date::format("%H%M", -offset_)}; 68 | } 69 | 70 | const OffsetZone* operator->() const {return this;} 71 | }; 72 | 73 | #endif // OFFSET_ZONE_H 74 | -------------------------------------------------------------------------------- /3rdparty/date/test/tz_test/OffsetZone.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2017 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // Test custom time zone support 24 | 25 | #include "tz.h" 26 | #include "OffsetZone.h" 27 | #include 28 | 29 | int 30 | main() 31 | { 32 | using namespace date; 33 | using namespace std::chrono; 34 | auto now = system_clock::now(); 35 | auto offset = hours{-4}; 36 | zoned_time zt{OffsetZone{offset}, now}; 37 | assert(zt.get_local_time().time_since_epoch() == now.time_since_epoch() + offset); 38 | } 39 | -------------------------------------------------------------------------------- /3rdparty/date/test/tz_test/README.md: -------------------------------------------------------------------------------- 1 | # TZ Test 2 | 3 | ## How to Test 4 | 5 | * Install tz.cpp by downloading the IANA timezone database at: http://www.iana.org/time-zones You only need the data, not the code. 6 | * Change the string `install` in tz.cpp to point to your downloaded IANA database. 7 | * Compile validate.cpp along with tz.cpp. 8 | * Run the binary and direct the terminal output to a temporary file. 9 | * Unzip the tzdata file that has the version corresponding to the IANA database you downloaded (e.g. tzdata2015f.txt.zip). 10 | * Compare the unzipped txt file with the output of your validate test program. If they are identical, the test passes, else it fails. 11 | 12 | ## Miscellaneous 13 | 14 | You can also compare one version of the tzdatabase with another using 15 | these uncompressed text files. The text files contain for each 16 | timezone its initial state, and each {offset, abbreviation} change 17 | contained in the database up through the year 2035. As the database 18 | versions change, minor updates to the set of these transitions are 19 | typically made, typically due to changes in government policies. 20 | 21 | The tests in this section will run much faster with optimizations 22 | cranked up. 23 | -------------------------------------------------------------------------------- /3rdparty/date/test/tz_test/zone.pass.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015, 2016 Howard Hinnant 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #include "tz.h" 24 | #include 25 | 26 | int 27 | main() 28 | { 29 | using namespace std; 30 | using namespace date; 31 | static_assert( is_nothrow_destructible{}, ""); 32 | static_assert(!is_default_constructible{}, ""); 33 | static_assert(!is_copy_constructible{}, ""); 34 | static_assert(!is_copy_assignable{}, ""); 35 | static_assert( is_nothrow_move_constructible{}, ""); 36 | static_assert( is_nothrow_move_assignable{}, ""); 37 | } 38 | -------------------------------------------------------------------------------- /3rdparty/date/test_fail.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo $1 4 | eval $1 5 | 6 | if [ $? -eq 0 ]; then 7 | exit 0; 8 | fi 9 | exit 1; 10 | 11 | -------------------------------------------------------------------------------- /3rdparty/date/wcjohns_readme.txt: -------------------------------------------------------------------------------- 1 | This library was downloaded 20200502 from https://github.com/HowardHinnant/date and cooresponds to git hash e12095f. 2 | No modifications to the library have been made, other than this file. 3 | -------------------------------------------------------------------------------- /3rdparty/nlohmann/LICENSE.MIT: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2013-2017 Niels Lohmann 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /3rdparty/rapidxml/license.txt: -------------------------------------------------------------------------------- 1 | Use of this software is granted under one of the following two licenses, 2 | to be chosen freely by the user. 3 | 4 | 1. Boost Software License - Version 1.0 - August 17th, 2003 5 | =============================================================================== 6 | 7 | Copyright (c) 2006, 2007 Marcin Kalicinski 8 | 9 | Permission is hereby granted, free of charge, to any person or organization 10 | obtaining a copy of the software and accompanying documentation covered by 11 | this license (the "Software") to use, reproduce, display, distribute, 12 | execute, and transmit the Software, and to prepare derivative works of the 13 | Software, and to permit third-parties to whom the Software is furnished to 14 | do so, all subject to the following: 15 | 16 | The copyright notices in the Software and this entire statement, including 17 | the above license grant, this restriction and the following disclaimer, 18 | must be included in all copies of the Software, in whole or in part, and 19 | all derivative works of the Software, unless such copies or derivative 20 | works are solely in the form of machine-executable object code generated by 21 | a source language processor. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 26 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 27 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 28 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 29 | DEALINGS IN THE SOFTWARE. 30 | 31 | 2. The MIT License 32 | =============================================================================== 33 | 34 | Copyright (c) 2006, 2007 Marcin Kalicinski 35 | 36 | Permission is hereby granted, free of charge, to any person obtaining a copy 37 | of this software and associated documentation files (the "Software"), to deal 38 | in the Software without restriction, including without limitation the rights 39 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 40 | of the Software, and to permit persons to whom the Software is furnished to do so, 41 | subject to the following conditions: 42 | 43 | The above copyright notice and this permission notice shall be included in all 44 | copies or substantial portions of the Software. 45 | 46 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 47 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 48 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 49 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 50 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 51 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 52 | IN THE SOFTWARE. 53 | -------------------------------------------------------------------------------- /SpecUtils/D3SpectrumExportResources.h.in: -------------------------------------------------------------------------------- 1 | #ifndef D3_SPECTRUM_EXPORT_RESOURCES_H 2 | #define D3_SPECTRUM_EXPORT_RESOURCES_H 3 | 4 | /* SpecUtils: a library to parse, save, and manipulate gamma spectrum data files. 5 | 6 | Copyright 2018 National Technology & Engineering Solutions of Sandia, LLC 7 | (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. 8 | Government retains certain rights in this software. 9 | For questions contact William Johnson via email at wcjohns@sandia.gov, or 10 | alternative emails of interspec@sandia.gov. 11 | 12 | This library is free software; you can redistribute it and/or 13 | modify it under the terms of the GNU Lesser General Public 14 | License as published by the Free Software Foundation; either 15 | version 2.1 of the License, or (at your option) any later version. 16 | 17 | This library is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | Lesser General Public License for more details. 21 | 22 | You should have received a copy of the GNU Lesser General Public 23 | License along with this library; if not, write to the Free Software 24 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | #ifndef SpecUtils_D3_SUPPORT_FILE_STATIC 28 | #cmakedefine01 SpecUtils_D3_SUPPORT_FILE_STATIC 29 | #endif 30 | 31 | 32 | #if( SpecUtils_D3_SUPPORT_FILE_STATIC ) 33 | @D3_MIN_JS_ARR@ 34 | @D3_MIN_JS_LEN@ 35 | 36 | @SPECTRUM_CHART_D3_JS_ARR@ 37 | @SPECTRUM_CHART_D3_JS_LEN@ 38 | 39 | @SPECTRUM_CHART_D3_CSS_ARR@ 40 | @SPECTRUM_CHART_D3_CSS_LEN@ 41 | 42 | #else 43 | @D3_SUPPORT_FILE_RUNTIME_DIR@ 44 | @D3_MIN_JS_FILE@ 45 | @SPECTRUM_CHART_D3_JS_FILE@ 46 | @SPECTRUM_CHART_D3_CSS_FILE@ 47 | #endif 48 | 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /SpecUtils/SpecUtils_config.h.in: -------------------------------------------------------------------------------- 1 | #ifndef SpecUtils_config_h 2 | #define SpecUtils_config_h 3 | /* SpecUtils: a library to parse, save, and manipulate gamma spectrum data files. 4 | 5 | Copyright 2018 National Technology & Engineering Solutions of Sandia, LLC 6 | (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. 7 | Government retains certain rights in this software. 8 | For questions contact William Johnson via email at wcjohns@sandia.gov, or 9 | alternative emails of interspec@sandia.gov. 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Lesser General Public 13 | License as published by the Free Software Foundation; either 14 | version 2.1 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Lesser General Public License for more details. 20 | 21 | You should have received a copy of the GNU Lesser General Public 22 | License along with this library; if not, write to the Free Software 23 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 24 | */ 25 | 26 | 27 | #cmakedefine01 PERFORM_DEVELOPER_CHECKS 28 | #cmakedefine01 SpecUtils_ENABLE_D3_CHART 29 | #cmakedefine01 SpecUtils_ENABLE_URI_SPECTRA 30 | #cmakedefine01 SpecUtils_USE_WT_THREADPOOL 31 | #cmakedefine01 SpecUtils_USING_NO_THREADING 32 | #cmakedefine01 SpecUtils_D3_SUPPORT_FILE_STATIC 33 | #cmakedefine01 SpecUtils_INJA_TEMPLATES 34 | #cmakedefine01 SpecUtils_BUILD_FUZZING_TESTS 35 | 36 | #cmakedefine01 SpecUtils_PYTHON_BINDINGS 37 | #cmakedefine01 SpecUtils_JAVA_SWIG 38 | 39 | #cmakedefine01 SpecUtils_USE_SIMD 40 | #cmakedefine01 SpecUtils_ENABLE_EQUALITY_CHECKS 41 | 42 | #cmakedefine01 SpecUtils_USE_FAST_FLOAT 43 | #cmakedefine01 SpecUtils_USE_FROM_CHARS 44 | #cmakedefine01 SpecUtils_USE_BOOST_SPIRIT 45 | #cmakedefine01 SpecUtils_USE_STRTOD 46 | 47 | #include 48 | 49 | #if( defined(_WIN32) && defined(_MSC_VER) ) 50 | #include 51 | #include 52 | #include 53 | #define isnan(x) _isnan(x) 54 | #define isinf(x) (!_finite(x)) 55 | #if( _MSC_VER <= 1700 ) 56 | #define snprintf _snprintf_s 57 | #endif 58 | #endif 59 | 60 | 61 | #ifndef IsInf 62 | #define IsInf(x) (std::isinf)(x) 63 | #endif 64 | 65 | #ifndef IsNan 66 | #define IsNan(x) (std::isnan)(x) 67 | #endif 68 | 69 | #if(PERFORM_DEVELOPER_CHECKS) 70 | //log_developer_error(...) is implemented in SpecFile.cpp, but 71 | // declared here so can be used everywhere. 72 | //Error messages go to developer_errors.log in the cwd 73 | void log_developer_error( const char *location, const char *error ); 74 | #endif 75 | 76 | #endif // InterSpec_config_h 77 | -------------------------------------------------------------------------------- /bindings/node/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_policy(SET CMP0048 NEW) 2 | project( SpecUtilsJS ) 3 | 4 | # npm install -g cmake-js 5 | # npm install --save-dev node-addon-api 6 | # cmake-js --CDSpecUtils_FLT_PARSE_METHOD="strtod" --CDCMAKE_BUILD_TYPE="Release" 7 | # cmake-js build --target install 8 | 9 | cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) 10 | 11 | set( CMAKE_CXX_STANDARD 11 ) 12 | set( CMAKE_CXX_STANDARD_REQUIRED ON ) 13 | set( CMAKE_POSITION_INDEPENDENT_CODE ON ) 14 | 15 | IF(WIN32) 16 | set( MSVC_RUNTIME "static" ) 17 | include( cmake/ConfigureMsvc.txt ) 18 | configure_msvc_runtime() 19 | set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj -D_SCL_SECURE_NO_WARNINGS /MP /wd4996 /wd4267 /DWINVER=0x0601 /D_WIN32_WINNT=0x0601" ) 20 | #0x0601==Win7, 0x0501==WinXP 21 | ENDIF(WIN32) 22 | 23 | 24 | include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) 25 | add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/../.. ${CMAKE_CURRENT_BINARY_DIR}/LibSpecUtils ) 26 | 27 | include_directories(${CMAKE_JS_INC}) 28 | set( SOURCE_FILES example.js SpecUtilsJS.h SpecUtilsJS.cpp ) 29 | add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC}) 30 | set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node") 31 | target_link_libraries(${PROJECT_NAME} PUBLIC ${CMAKE_JS_LIB} SpecUtils ) 32 | 33 | target_include_directories( ${PROJECT_NAME} PUBLIC 34 | node_modules/node-addon-api/ 35 | ${CMAKE_CURRENT_SOURCE_DIR}/../.. 36 | ) 37 | 38 | 39 | install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/example.js DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/node_release/ ) 40 | install( TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/node_release/ ) 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /bindings/node/cmake/ConfigureMsvc.txt: -------------------------------------------------------------------------------- 1 | #from https://stackoverflow.com/questions/10113017/setting-the-msvc-runtime-in-cmake 2 | 3 | macro(configure_msvc_runtime) 4 | if(MSVC) 5 | # Default to statically-linked runtime. 6 | if("${MSVC_RUNTIME}" STREQUAL "") 7 | set(MSVC_RUNTIME "static") 8 | endif() 9 | # Set compiler options. 10 | set(variables 11 | CMAKE_C_FLAGS_DEBUG 12 | CMAKE_C_FLAGS_MINSIZEREL 13 | CMAKE_C_FLAGS_RELEASE 14 | CMAKE_C_FLAGS_RELWITHDEBINFO 15 | CMAKE_CXX_FLAGS_DEBUG 16 | CMAKE_CXX_FLAGS_MINSIZEREL 17 | CMAKE_CXX_FLAGS_RELEASE 18 | CMAKE_CXX_FLAGS_RELWITHDEBINFO 19 | ) 20 | if(${MSVC_RUNTIME} STREQUAL "static") 21 | message(STATUS 22 | "MSVC -> forcing use of statically-linked runtime." 23 | ) 24 | foreach(variable ${variables}) 25 | if(${variable} MATCHES "/MD") 26 | string(REGEX REPLACE "/MD" "/MT" ${variable} "${${variable}}") 27 | endif() 28 | endforeach() 29 | else() 30 | message(STATUS 31 | "MSVC -> forcing use of dynamically-linked runtime." 32 | ) 33 | foreach(variable ${variables}) 34 | if(${variable} MATCHES "/MT") 35 | string(REGEX REPLACE "/MT" "/MD" ${variable} "${${variable}}") 36 | endif() 37 | endforeach() 38 | endif() 39 | endif() 40 | endmacro() -------------------------------------------------------------------------------- /bindings/node/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "SpecUtils", 3 | "version": "1", 4 | "description": "Spectrum file parsing and converting library", 5 | "homepage": "https://github.com/sandialabs/InterSpec", 6 | "private": true, 7 | "main": "example.js", 8 | "repository": { 9 | "url": "https://github.com/sandialabs/SpecUtils", 10 | "type": "git" 11 | }, 12 | "scripts": { 13 | "make": "cmake-js build --out=build --target install", 14 | "example": "node ./build/example/" 15 | }, 16 | "author": { 17 | "name": "William Johnson", 18 | "email": "wcjohns@sandia.gov" 19 | }, 20 | "license": "LGPL-2.1-only", 21 | "devDependencies": { 22 | "cmake-js": "^6.3.2", 23 | "node-addon-api": "^2.0.2" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /bindings/python/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15...3.26) 2 | 3 | project(SpecUtils_py LANGUAGES CXX) 4 | 5 | set(CMAKE_POSITION_INDEPENDENT_CODE ON) 6 | 7 | set( SpecUtils_ENABLE_D3_CHART ON CACHE BOOL "" ) 8 | set( SpecUtils_D3_SUPPORT_FILE_STATIC ON CACHE BOOL "" ) 9 | set( SpecUtils_ENABLE_URI_SPECTRA OFF CACHE BOOL "" ) #Lets not worry about linking to zlib right now 10 | set( SpecUtils_PYTHON_BINDINGS ON CACHE BOOL "Build the python bindings" ) 11 | set( SpecUtils_ENABLE_EQUALITY_CHECKS OFF CACHE BOOL "" ) 12 | set( PERFORM_DEVELOPER_CHECKS OFF CACHE BOOL "" ) 13 | set( SpecUtils_SHARED_LIB OFF CACHE BOOL "" ) #we'll statically link SpecUtils into the lib we create here 14 | set( SpecUtils_FLT_PARSE_METHOD "strtod" CACHE STRING "Float parsing method" ) 15 | 16 | add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/../.. ${CMAKE_CURRENT_BINARY_DIR}/LibSpecUtils ) 17 | 18 | if (NOT SKBUILD) 19 | message(FATAL_ERROR "\ 20 | This CMake file is must be executed using 'scikit-build'. 21 | If you are a user trying to install this package, please use the command 22 | below, which will install all necessary build dependencies, compile 23 | the package in an isolated environment, and then install it. 24 | ===================================================================== 25 | $ pip install . 26 | ===================================================================== 27 | If you are a software developer, and this is your own package, then 28 | it is usually much more efficient to install the build dependencies 29 | in your environment once and use the following command that avoids 30 | a costly creation of a new virtual environment at every compilation: 31 | ===================================================================== 32 | $ pip install nanobind scikit-build-core 33 | $ pip install --no-build-isolation -ve . 34 | ===================================================================== 35 | You may optionally add -Ceditable.rebuild=true to auto-rebuild when 36 | the package is imported. Otherwise, you need to re-run the above 37 | after editing C++ files.") 38 | endif() 39 | 40 | # Try to import all Python components potentially needed by nanobind 41 | find_package(Python 3.8 42 | REQUIRED COMPONENTS Interpreter Development.Module 43 | OPTIONAL_COMPONENTS Development.SABIModule) 44 | 45 | # Import nanobind through CMake's find_package mechanism 46 | find_package(nanobind CONFIG REQUIRED) 47 | 48 | # We are now ready to compile the actual extension module 49 | nanobind_add_module( 50 | # Name of the extension 51 | PySpecUtils 52 | 53 | # Target the stable ABI for Python 3.12+, which reduces 54 | # the number of binary wheels that must be built. This 55 | # does nothing on older Python versions 56 | STABLE_ABI 57 | 58 | # Build libnanobind statically and merge it into the 59 | # extension (which itself remains a shared library) 60 | # 61 | # If your project builds multiple extensions, you can 62 | # replace this flag by NB_SHARED to conserve space by 63 | # reusing a shared libnanobind across libraries 64 | NB_STATIC 65 | 66 | #Perform link time optimization. 67 | #LTO 68 | 69 | 70 | # Source code goes here 71 | SpecFile_py.cpp 72 | ) 73 | 74 | set_target_properties( PySpecUtils PROPERTIES OUTPUT_NAME "SpecUtils" ) 75 | target_link_libraries( PySpecUtils PUBLIC SpecUtils ) 76 | 77 | # Install directive for scikit-build-core 78 | install(TARGETS PySpecUtils LIBRARY DESTINATION SpecUtils) 79 | install(FILES __init__.py DESTINATION SpecUtils) 80 | 81 | nanobind_add_stub( 82 | SpecUtils_stub 83 | MODULE SpecUtils 84 | OUTPUT SpecUtils.pyi 85 | PYTHON_PATH $ 86 | DEPENDS PySpecUtils 87 | ) -------------------------------------------------------------------------------- /bindings/python/README.md: -------------------------------------------------------------------------------- 1 | # Gamma Spectrum file utilities 2 | 3 | [SpecUtils](https://github.com/sandialabs/SpecUtils) is a library for reading, manipulating, and exporting spectrum files produced by RadioIsotope Identification Devices (RIIDs), Radiation Portal Monitors (RPMs), radiation search systems, Personal Radiation Detectors (PRDs), and many laboratory detection systems. 4 | It opens [N42](https://www.nist.gov/programs-projects/ansiieee-n4242-standard) (2006 and 2012 formats), [SPE](https://inis.iaea.org/collection/NCLCollectionStore/_Public/32/042/32042415.pdf), [SPC](https://web.archive.org/web/20160418031030/www.ortec-online.com/download/ortec-software-file-structure-manual.pdf), CSV, TXT, [PCF](https://www.osti.gov/biblio/1378172-pcf-file-format), [DAT](https://www.aseg.org.au/sites/default/files/gr-135.pdf), and many more files; altogether much more than a 100 file format variants. This library lets you either programmatically access and/or modify the parsed information, or you can save it to any of 13 different formats, or create spectrum files from scratch. 5 | 6 | 7 | This package is a Python wrapper around the C++ [SpecUtils](https://github.com/sandialabs/SpecUtils) library, with the bindings created using [nanobind](https://github.com/wjakob/nanobind). [SpecUtils](https://github.com/sandialabs/SpecUtils) is primarily developed as part of [InterSpec](https://github.com/sandialabs/InterSpec/), but is also used by [Cambio](https://github.com/sandialabs/Cambio/), and a number of other projects. 8 | 9 | An example use is: 10 | ```python 11 | import SpecUtils 12 | 13 | # Create a SpecFile object 14 | spec = SpecUtils.SpecFile() 15 | 16 | # Load a spectrum file 17 | spec.loadFile("spectrum_file.n42", SpecUtils.ParserType.Auto) 18 | 19 | # Get list of all individual records in the spectrum file 20 | meass = spec.measurements() 21 | print( "There are", len(meass), "spectrum records." ) 22 | 23 | # Get first measurement 24 | meas = meass[0] 25 | 26 | # Get gamma counts, and the lower energy of each channel 27 | counts = meas.gammaCounts() 28 | energies = meas.channelEnergies() 29 | 30 | # Get neutron counts 31 | neutrons = meas.neutronCountsSum() 32 | 33 | # Get start time 34 | startime = meas.startTime() 35 | 36 | # Print out CSV information of energies and counts 37 | print( "StartTime: ", startime ) 38 | print( "Neutron counts: ", neutrons, "\n" ) 39 | print( "Energy (keV), Counts" ) 40 | for i in range(len(counts)): 41 | print( f"{energies[i]},{counts[i]}" ) 42 | ``` 43 | 44 | For further examples, see the [examples](https://github.com/sandialabs/SpecUtils/tree/master/bindings/python/examples) directory. 45 | To run the examples, run the following commands: 46 | ``` 47 | python test_python.py 48 | python make_file_example.py 49 | python make_html_plot.py /some/path/to/a/file.n42 50 | ``` 51 | 52 | 53 | ## Installation 54 | You can install the package using pip like this: 55 | ``` 56 | mkdir my_venv 57 | python -m venv my_venv 58 | 59 | source my_venv/bin/activate 60 | pip install SandiaSpecUtils 61 | 62 | python 63 | >>> import SpecUtils 64 | >>> spec = SpecUtils.SpecFile() 65 | >>> ... 66 | ``` 67 | 68 | 69 | Or instead, you can compile from source yourself, with something like: 70 | ``` 71 | git clone https://github.com/sandialabs/SpecUtils.git SpecUtils 72 | 73 | # Optionsally make/use a virtual environment 74 | mkdir my_venv 75 | python3 -m venv my_venv 76 | source my_venv/bin/activate # Windows PowerShell: .\my_venv\Scripts\Activate.ps1 77 | 78 | # Compile and install the bindings 79 | pip install SpecUtils/bindings/python 80 | 81 | # Use the package 82 | python 83 | >>> import SpecUtils 84 | ``` 85 | 86 | 87 | ## Support 88 | Please create an issue on the [SpecUtils GitHub repository](https://github.com/sandialabs/SpecUtils/issues), or email InterSpec@sandia.gov if you have any questions or problems. 89 | -------------------------------------------------------------------------------- /bindings/python/__init__.py: -------------------------------------------------------------------------------- 1 | from . import SpecUtils 2 | from .SpecUtils import * -------------------------------------------------------------------------------- /bindings/python/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["scikit-build-core >=0.10", "nanobind >=1.3.2", "typing-extensions >= 4.0"] 3 | build-backend = "scikit_build_core.build" 4 | 5 | [project] 6 | name = "SandiaSpecUtils" 7 | version = "0.0.4" 8 | description = "Python bindings for SpecUtils using nanobind and scikit-build" 9 | readme = "README.md" 10 | requires-python = ">=3.9" 11 | authors = [ 12 | { name = "Will Johnson", email = "wcjohns@sandia.gov" }, 13 | ] 14 | classifiers = [ 15 | "License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)", 16 | ] 17 | 18 | [project.urls] 19 | Homepage = "https://github.com/sandialabs/SpecUtils" 20 | 21 | 22 | [tool.scikit-build] 23 | # Protect the configuration against future changes in scikit-build-core 24 | minimum-version = "build-system.requires" 25 | 26 | # Setuptools-style build caching in a local directory 27 | build-dir = "build/{wheel_tag}" 28 | 29 | # Build stable ABI wheels for CPython 3.12+ 30 | wheel.py-api = "cp312" 31 | 32 | [tool.cibuildwheel] 33 | # Necessary to see build output from the actual compilation 34 | build-verbosity = 1 35 | 36 | # Run pytest to ensure that the package was correctly built 37 | test-command = "python -m unittest discover {project}/bindings/python/tests" 38 | #test-requires = "pytest" 39 | 40 | # Don't test Python 3.8 wheels on macOS/arm64 41 | test-skip="cp38-macosx_*:arm64" 42 | 43 | # Needed for full C++17 support 44 | [tool.cibuildwheel.macos.environment] 45 | MACOSX_DEPLOYMENT_TARGET = "10.14" 46 | -------------------------------------------------------------------------------- /bindings/python/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/SpecUtils/67c6a16c929e69ed0896b07e50f13540e3348c37/bindings/python/tests/__init__.py -------------------------------------------------------------------------------- /bindings/swig/README.md: -------------------------------------------------------------------------------- 1 | 2 | To compile with support for Java use the following commands: 3 | ```bash 4 | cd SpecUtils 5 | mkdir build 6 | cd build 7 | cmake -DSpecUtils_JAVA_SWIG=ON .. 8 | make -j4 9 | ``` 10 | 11 | To then run the example Java executable, do: 12 | ```bash 13 | cp ../bindings/swig/java_example/* . 14 | javac -classpath .:jcommon-1.0.21.jar:jfreechart-1.0.17.jar:joda-time-2.9.jar *.java gov/sandia/specutils/*.java 15 | java -Djava.library.path="." -classpath .:jcommon-1.0.21.jar:jfreechart-1.0.17.jar:joda-time-2.9.jar Main 16 | ``` 17 | -------------------------------------------------------------------------------- /bindings/swig/SpecUtils.i: -------------------------------------------------------------------------------- 1 | %module SpecUtilsSwig 2 | 3 | 4 | %rename(operatorEqual) operator=; 5 | 6 | 7 | %include "std_string.i" 8 | %include "std_wstring.i" 9 | %include "wchar.i" 10 | 11 | %include "std_vector.i" 12 | namespace std { 13 | %template(StringVector) vector; 14 | %template(IntVector) vector; 15 | } 16 | 17 | 18 | %include "std_shared_ptr.i" 19 | %shared_ptr(SpecUtils::Measurement) 20 | %shared_ptr(std::vector) 21 | 22 | namespace std { 23 | %template(FloatVector) vector; 24 | } 25 | 26 | 27 | 28 | 29 | %include "cpointer.i" 30 | 31 | 32 | 33 | %{ 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | using namespace std; 40 | %} 41 | %inline %{ 42 | std::ostream* openFile(const char* filename) { 43 | ofstream *filePtr = new ofstream(filename); 44 | return(filePtr); 45 | } 46 | void closeFile(std::ostream *stream) { 47 | stream->flush(); 48 | delete(stream); 49 | } 50 | 51 | std::ostream* createStringStream() { 52 | std::stringstream *sPtr = new std::stringstream(); 53 | return(sPtr); 54 | } 55 | 56 | std::string stringStreamToString(std::ostream *stream) { 57 | return dynamic_cast(stream)->str(); 58 | } 59 | 60 | void cleanupStringString(std::ostream *stream) { 61 | delete(stream); 62 | } 63 | 64 | %} 65 | 66 | 67 | 68 | 69 | 70 | %{ 71 | #include 72 | #include 73 | %} 74 | 75 | 76 | %include "SpecUtils_config.h" 77 | 78 | %{ 79 | #include 80 | #include "SpecUtils/SpecFile.h" 81 | %} 82 | 83 | 84 | 85 | %include "SpecUtils/SpecFile.h" 86 | 87 | %{ 88 | #include "SpecUtils/EnergyCalibration.h" 89 | %} 90 | 91 | %include "SpecUtils/EnergyCalibration.h" 92 | 93 | %{ 94 | #include "D3SpectrumExportResources.h" 95 | #include "SpecUtils/D3SpectrumExport.h" 96 | %} 97 | 98 | %include "D3SpectrumExportResources.h" 99 | %include "SpecUtils/D3SpectrumExport.h" 100 | -------------------------------------------------------------------------------- /bindings/swig/java_example/HowToCreateJavaWrappersForC++Code.txt: -------------------------------------------------------------------------------- 1 | Java wrapper for MeasurementInfo C++ code 2 | 3 | SWIG is used to generate Java wrappers for the MeasurementInfo C++ code. This will allow Java code to invoke public methods in the C++ code. 4 | 5 | To use SWIG, a SWIG interface file has to be created. A sample interface file can be found here: bindings/swig/SpecUtils.i. This sample file brings in public declarations that are in SpecUtils/SpecUtils.h. SWIG will generate a large number of .java wrapper files. 6 | 7 | Public C++ methods, which have primitive parameters and primitive return values such as int, float, double, char*, or std::string, are the easiest the wrap. In almost all cases, Java primitive arguments can be passed to the C++ code and the result are Java primitive data types. 8 | Example: 9 | bool load_file( const std::string &filename, ParserType parser_type, std::string file_ending_hint) 10 | Java code: boolean result = info.load_file( filename, ParserType.kAutoParser, "" ) 11 | NOTE: ParserType is an enum. 12 | 13 | For public methods that contain an object as a parameter or that returns an object, many times it is much easier to write a helper method, in the C++ code, that contains only primitive parameters and returns a primitive value. 14 | Example: 15 | bool write_csv( std::ostream &ostr ) const 16 | Helper method: bool write_csv(std::string filename) const 17 | 18 | For methods whose parameters or return value can’t be converted to primitive data types, helper methods can be written inside the SWIG interface file. The example interface file shows two helper methods to manipulate an ostream object. The first method creates an ostream object. The second method uses the ostream object to flush the stream. Here is how these two methods can be used in 19 | Example Java code: 20 | /* call an interface helper method to create an ostream object */ 21 | SWIGTYPE_p_std__ostream file = SpecUtilsSwig.openFile("data_generatedFile.pcf"); 22 | /* use the ostream object by calling a method inside the C++ code */ 23 | info.write_csv(file); 24 | /* call an interface helper method to flush the stream */ 25 | SpecUtilsSwig.closeFile(file); 26 | 27 | C++ operators, such as operator=, must be assigned to a Java method. This happens inside the SWIG interface file. The example interface file wraps operator= to a method named operatorEqual. 28 | 29 | C++ vectors must be assigned to a Java class. This happens inside the SWIG interface file. The example interface file wraps vector to a Java class named StringVector. Swig will generate the StringVector class. The class has properties and methods to manipulate the vector. 30 | -------------------------------------------------------------------------------- /bindings/swig/java_example/NOTICE.txt: -------------------------------------------------------------------------------- 1 | ============================================================================= 2 | = NOTICE file corresponding to section 4d of the Apache License Version 2.0 = 3 | ============================================================================= 4 | This product includes software developed by 5 | Joda.org (http://www.joda.org/). 6 | -------------------------------------------------------------------------------- /bindings/swig/java_example/jcommon-1.0.21.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/SpecUtils/67c6a16c929e69ed0896b07e50f13540e3348c37/bindings/swig/java_example/jcommon-1.0.21.jar -------------------------------------------------------------------------------- /bindings/swig/java_example/jfreechart-1.0.17.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/SpecUtils/67c6a16c929e69ed0896b07e50f13540e3348c37/bindings/swig/java_example/jfreechart-1.0.17.jar -------------------------------------------------------------------------------- /bindings/swig/java_example/joda-time-2.9.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/SpecUtils/67c6a16c929e69ed0896b07e50f13540e3348c37/bindings/swig/java_example/joda-time-2.9.jar -------------------------------------------------------------------------------- /bindings/swig/java_example/readme.txt: -------------------------------------------------------------------------------- 1 | http://www.jfree.org/jcommon/ [LGPL 2.1 or later] 2 | http://www.jfree.org/jfreechart/ [LGPL] 3 | http://www.joda.org/joda-time/index.html [Apache 2.0 licence] 4 | -------------------------------------------------------------------------------- /d3_resources/README.txt: -------------------------------------------------------------------------------- 1 | This is an example of how you can integrate the spectrum plotting into your HTML documents. 2 | The interactions with the chart will essentually be the same as in InterSpec, just with no peak fitting and similar. 3 | 4 | d3.v3.min.js: Licensed unde BSD. See top of d3.v3.min.js for copywrite. https://d3js.org/ -------------------------------------------------------------------------------- /d3_resources/example_json_input.json: -------------------------------------------------------------------------------- 1 | [ 2 | 3 | { 4 | "title":null, 5 | "peaks":[], 6 | "liveTime":330, 7 | "realTime":330.061, 8 | "neutrons":6.0011, 9 | "lineColor":"black", 10 | "x": [-1.18568,0.575475,2.3862,4.24741,6.16002,8.12494,10.1431,12.2153,14.3424,16.5254,18.7652,21.0624,23.4181,25.8329,28.3079,30.8437,33.4411,36.1011,38.8244,41.6117,44.4638,47.3815,50.3657,53.4169,56.5359,59.7236,62.9805,66.3075,69.7052,73.1744,76.7156,80.3297,84.0172,87.7788,91.6153,95.5272,99.5151,103.58,107.722,111.942,116.24,120.618,125.075,129.613,134.231,138.931,143.713,148.577,153.525,158.556,163.671,168.871,174.156,179.527,184.983,190.526,196.157,201.874,207.68,213.574,219.557,225.629,231.791,238.043,244.385,250.818,257.343,263.959,270.667,277.467,284.36,291.346,298.425,305.598,312.865,320.226,327.682,335.233,342.878,350.62,358.456,366.389,374.418,382.543,390.765,399.084,407.5,416.013,424.623,433.332,442.137,451.041,460.043,469.144,478.342,487.64,497.036,506.53,516.124,525.817,535.608,545.499,555.489,565.579,575.767,586.055,596.443,606.93,617.517,628.203,638.988,649.873,660.858,671.942,683.125,694.408,705.79,717.271,728.852,740.532,752.311,764.189,776.165,788.241,800.415,812.688,825.059,837.528,850.096,862.761,875.524,888.385,901.343,914.398,927.551,940.8,954.146,967.588,981.126,994.76,1008.49,1022.32,1036.24,1050.25,1064.36,1078.56,1092.86,1107.25,1121.74,1136.32,1150.99,1165.75,1180.6,1195.55,1210.59,1225.71,1240.93,1256.24,1271.64,1287.13,1302.7,1318.37,1334.12,1349.96,1365.88,1381.9,1398,1414.18,1430.45,1446.8,1463.24,1479.76,1496.37,1513.06,1529.82,1546.67,1563.61,1580.62,1597.71,1614.88,1632.13,1649.45,1666.86,1684.34,1701.89,1719.52,1737.23,1755.01,1772.86,1790.79,1808.79,1826.86,1845,1863.21,1881.49,1899.84,1918.25,1936.73,1955.28,1973.9,1992.58,2011.32,2030.13,2048.99,2067.92,2086.92,2105.97,2125.08,2144.24,2163.47,2182.75,2202.09,2221.48,2240.93,2260.43,2279.98,2299.58,2319.24,2338.94,2358.69,2378.49,2398.34,2418.23,2438.16,2458.14,2478.17,2498.23,2518.33,2538.48,2558.66,2578.88,2599.14,2619.44,2639.76,2660.12,2680.52,2700.94,2721.4,2741.88,2762.4,2782.94,2803.5,2824.09,2844.71,2865.34,2886,2906.68,2927.37,2948.09,2968.82,2989.57,3010.33,3031.1,3051.89,3072.68,3093.49,3114.29], 11 | "y":[0,0,0,0,0,0,0,0,0,13,191,215,261,294,271,246,284,248,278,274,273,318,367,434,476,577,637,783,835,875,835,895,934,927,953,1020,1009,973,1013,1037,1001,1052,1043,1120,1101,1047,1051,1137,997,1048,942,1049,1062,983,988,1009,1084,1004,1049,1021,1181,1252,1409,1593,1460,1351,947,714,731,670,652,620,575,583,545,605,606,570,555,542,473,406,330,337,341,352,324,319,299,282,301,304,261,344,337,348,331,368,368,340,316,347,420,438,528,524,471,349,265,233,210,174,153,175,186,171,209,205,192,204,181,181,146,138,149,158,162,171,141,176,175,211,249,207,251,254,193,193,153,149,113,100,93,79,103,99,74,80,84,92,94,82,90,75,57,67,77,58,68,50,49,50,49,59,51,47,73,68,90,117,132,143,126,87,78,67,72,77,62,63,52,49,39,55,49,40,46,47,42,33,44,31,34,36,33,40,32,37,39,35,39,43,37,42,47,46,63,61,47,60,48,40,49,53,52,41,48,30,43,40,23,29,27,24,20,26,23,54,57,65,71,72,45,29,25,13,10,6,2,4,1,4,2,2,2,1,1,3,3,4,2,0,0,4,2,0], 12 | "yScaleFactor":1 13 | } 14 | ] 15 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.1...3.13) 2 | 3 | if(${CMAKE_VERSION} VERSION_LESS 3.12) 4 | cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) 5 | endif() 6 | 7 | project(SpecUtilExamples) 8 | 9 | add_executable( convert_to_n42 convert_to_n42.cpp ) 10 | target_link_libraries( convert_to_n42 PUBLIC SpecUtils ) 11 | 12 | add_executable( convert_to_cnf convert_to_cnf.cpp ) 13 | target_link_libraries( convert_to_cnf PUBLIC SpecUtils ) 14 | set_target_properties( convert_to_n42 convert_to_cnf PROPERTIES 15 | CXX_STANDARD 11 16 | CXX_STANDARD_REQUIRED YES 17 | CXX_EXTENSIONS NO 18 | ) 19 | 20 | 21 | if( SpecUtils_C_BINDINGS ) 22 | add_executable( c_interface_example c_interface_example.c ) 23 | set_source_files_properties( c_interface_example.c PROPERTIES LANGUAGE C ) 24 | set_target_properties( c_interface_example PROPERTIES C_STANDARD 99 C_STANDARD_REQUIRED YES ) 25 | target_link_libraries( c_interface_example PUBLIC SpecUtils ) 26 | endif( SpecUtils_C_BINDINGS ) 27 | -------------------------------------------------------------------------------- /examples/d3_chart_example/README.md: -------------------------------------------------------------------------------- 1 | This directory, d3_chart_example, contains two examples of how you might use the D3-based charting output of **SpecUtils**: 2 | 3 | * **self_contained_example.html**: This file contains the [D3](https://d3js.org/) source code, 4 | as well as the *SpectrumChartD3* JS and CSS, and the spectrum JSON, so that no other resources 5 | are necassary to view and interact with the spectrum in a browser. 6 | This file is the result of calling: `D3SpectrumExport::write_d3_html(...)`. 7 | * **json_example**: This example keeps the charting JavaScript, JSON, CSS, D3, HTML, etc. all in seperate 8 | files, similar to how you would do if you wanted to make a website served over the internet 9 | that displayed multiple different spectrum files. If you plot multiple spectra files, you would 10 | need to serve only a single copy of all the files, except for the JSON (created using 11 | `D3SpectrumExport::write_spectrum_data_js(...)` - perhaps a poorly named function) which each 12 | spectrum file would have their own JSON file. -------------------------------------------------------------------------------- /fuzz_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project( SpecUtilsFuzz VERSION 1 ) 2 | cmake_minimum_required( VERSION VERSION 3.11 FATAL_ERROR ) 3 | cmake_policy(SET CMP0048 NEW) 4 | cmake_policy(SET CMP0079 NEW) #allow altering SpecUtils linking from this file 5 | 6 | add_executable( file_parse_fuzz file_parse_fuzz.cpp fuzz_interface.h fuzz_interface.cpp ) 7 | 8 | # spirit float parser can assert with inputs like 9 | # ".000000000000000000000000000000000000000000000000000000000000000000000000000" 10 | # when we compile as RelWithDebInfo; so we'll disable this asserting for fuzzing 11 | target_compile_definitions( SpecUtils PUBLIC BOOST_DISABLE_ASSERTS ) 12 | 13 | target_compile_options( file_parse_fuzz PRIVATE $<$:-g -O1 -fsanitize=fuzzer,address,undefined -fprofile-instr-generate -fcoverage-mapping> ) 14 | target_compile_options( SpecUtils PRIVATE $<$:-g -O1 -fsanitize=fuzzer,address,undefined -fprofile-instr-generate -fcoverage-mapping> ) 15 | target_link_libraries( SpecUtils PUBLIC $<$:-fsanitize=fuzzer,address,undefined -fprofile-instr-generate -fcoverage-mapping > ) 16 | target_link_libraries( file_parse_fuzz PRIVATE SpecUtils $<$:-fsanitize=fuzzer,address,undefined> ) 17 | set_target_properties( file_parse_fuzz PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED YES CXX_EXTENSIONS NO ) 18 | 19 | #add_executable( run_one_file_parse run_one_file_parse.cpp fuzz_interface.h fuzz_interface.cpp ) 20 | #target_link_libraries( run_one_file_parse PRIVATE SpecUtils ) 21 | #set_target_properties( run_one_file_parse PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED YES CXX_EXTENSIONS NO ) 22 | 23 | add_executable( fuzz_str_utils fuzz_str_utils.cpp ) 24 | target_link_libraries( fuzz_str_utils PRIVATE SpecUtils $<$:-fsanitize=fuzzer,address,undefined -fprofile-instr-generate -fcoverage-mapping> ) 25 | set_target_properties( fuzz_str_utils PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED YES CXX_EXTENSIONS NO ) -------------------------------------------------------------------------------- /fuzz_test/README.md: -------------------------------------------------------------------------------- 1 | # Niave Fuzzing of File Parsing Code 2 | 3 | ## Compiling on macOS 4 | The default Apple compiler doesnt seem to dome with the clang fuzzing library, so you need to install `llvm` and use it to compile the code. The commands to do this that work for me are: 5 | 6 | ```bash 7 | brew install llvm 8 | 9 | unset CMAKE_OSX_DEPLOYMENT_TARGET 10 | 11 | # Since Big Sur v11.1, we need to fix up the LIBRARY_PATH variable 12 | export LIBRARY_PATH="$LIBRARY_PATH:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib" 13 | 14 | export LDFLAGS="-L/opt/homebrew/opt/llvm/lib" #maybe not necassary 15 | export CPPFLAGS="-I/opt/homebrew/opt/llvm/include" #maybe not necassary 16 | 17 | cd /path/to/SpecUtils 18 | mkdir build_fuzz 19 | 20 | cmake -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DCMAKE_IGNORE_PATH="/Applications/Xcode.app" -DCMAKE_PREFIX_PATH="/opt/homebrew/opt/llvm;/path/to/compiled/boost/" -DCMAKE_CXX_COMPILER="/opt/homebrew/opt/llvm/bin/clang++" -DCMAKE_C_COMPILER="/opt/homebrew/opt/llvm/bin/clang" -DCMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES="/opt/homebrew/opt/llvm/include/c++/v1" -DSpecUtils_BUILD_FUZZING_TESTS=ON .. 21 | 22 | cmake --build . --config RelWithDebInfo -j8 23 | ``` 24 | 25 | You then need to create a `CORPUS_DIR` that contains a wide variety of sample spectrum files. 26 | Once you do this, you can run a fuzz job, use a command like: 27 | ```bash 28 | # Fuzz for 5 minutes with max file size of 2.5 MB, using 8 different processes 29 | # (using -workers=16 argument doesnt seem to cause significantly more cpu use than a single worker) 30 | ./fuzz_test/file_parse_fuzz CORPUS_DIR -max_len=2621440 -jobs=8 -print_final_stats=1 -rss_limit_mb=4096 -max_total_time=300 31 | 32 | 33 | ./fuzz_test/fuzz_str_utils 34 | ``` 35 | 36 | Since files are written to your CORPUS_DIR, you probably want to make a copy of the directory, before running. 37 | 38 | 39 | ## Further information 40 | See https://llvm.org/docs/LibFuzzer.html for 41 | 42 | # Potential Future work 43 | - The fuzzing is probably really niave and could be made way more effective 44 | - Figure out memory limit to use, with an argument like '-rss_limit_mb=64' 45 | - Add fuzzing for all the string, datetime, and filesystem utilities 46 | - Could target each type of spectrum file parser using candidate files targeted specifically to them, instead of trying each parser for each input 47 | - Also try writing output files whenever the parsing was successful 48 | 49 | 50 | # Static Analysis 51 | Its also pretty easy to run static analysis over the code. 52 | 53 | ## CppCheck 54 | In your build directory, run something like the following commands. 55 | This will then cause CMake to run `cppcheck` over each source file when you build things, giving you the error messages 56 | ```bash 57 | cd path/to/build/dir 58 | cmake "-DCMAKE_CXX_CPPCHECK:FILEPATH=/usr/local/bin/cppcheck;--suppress=*:/path/to/boost/include/boost/config.hpp;--suppress=*:*:/path/to/boost/include/boost/include/boost/config/compiler/codegear.hpp;--force;--std=c++11" .. 59 | make clean 60 | make 61 | ``` 62 | 63 | ## Clang / scan-build 64 | To run clangs static analysis, use the following commands: 65 | ```bash 66 | cd /path/to/SpecUtils 67 | export PATH=/usr/local/opt/llvm/bin/:$PATH 68 | scan-build --use-cc=/usr/local/opt/llvm/bin/clang --use-c++=/usr/local/opt/llvm/bin/clang++ make -C build_dir 69 | ``` -------------------------------------------------------------------------------- /fuzz_test/file_parse_fuzz.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | SpecUtils: a library to parse, save, and manipulate gamma spectrum data files. 3 | Copyright (C) 2016 William Johnson 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #include "SpecUtils_config.h" 21 | 22 | #include 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | #include "fuzz_interface.h" 29 | #include "SpecUtils/SpecFile.h" 30 | 31 | using namespace std; 32 | 33 | extern "C" int LLVMFuzzerTestOneInput( const uint8_t *data, size_t size ) 34 | { 35 | return run_file_parse_fuzz( data, size ); 36 | } 37 | -------------------------------------------------------------------------------- /fuzz_test/fuzz_interface.h: -------------------------------------------------------------------------------- 1 | #ifndef SpecUtils_Fuzz_Interface_h 2 | #define SpecUtils_Fuzz_Interface_h 3 | /* SpecUtils: a library to parse, save, and manipulate gamma spectrum data files. 4 | 5 | Copyright 2018 National Technology & Engineering Solutions of Sandia, LLC 6 | (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. 7 | Government retains certain rights in this software. 8 | For questions contact William Johnson via email at wcjohns@sandia.gov, or 9 | alternative emails of interspec@sandia.gov. 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Lesser General Public 13 | License as published by the Free Software Foundation; either 14 | version 2.1 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Lesser General Public License for more details. 20 | 21 | You should have received a copy of the GNU Lesser General Public 22 | License along with this library; if not, write to the Free Software 23 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 24 | */ 25 | 26 | #include "SpecUtils_config.h" 27 | 28 | 29 | #include 30 | 31 | namespace SpecUtils 32 | { 33 | class SpecFile; 34 | } 35 | 36 | int run_file_parse_fuzz( const uint8_t *data, size_t size ); 37 | 38 | void test_write_output( const SpecUtils::SpecFile &spec ); 39 | 40 | #endif //SpecUtils_Fuzz_Interface_h 41 | -------------------------------------------------------------------------------- /fuzz_test/run_one_file_parse.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | SpecUtils: a library to parse, save, and manipulate gamma spectrum data files. 3 | Copyright (C) 2016 William Johnson 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #include "SpecUtils_config.h" 21 | 22 | #include 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "fuzz_interface.h" 30 | #include "SpecUtils/SpecFile.h" 31 | #include "SpecUtils/Filesystem.h" 32 | 33 | /** This program runs fuzz test cases to enable tracing down where the 34 | * problem is, and fixing it. 35 | */ 36 | int main( int argc, char **argv ) 37 | { 38 | try 39 | { 40 | const char *crash_filename = "/path/to/file/crash-..."; 41 | std::vector data; 42 | SpecUtils::load_file_data( crash_filename, data ); 43 | assert( data.size() > 1 ); 44 | std::vector data_actual( begin(data), end(data) - 1 ); //strip trailing '\0' inserted by SpecUtils::load_file_data 45 | 46 | auto t1 = std::chrono::high_resolution_clock::now(); 47 | 48 | const int rval = run_file_parse_fuzz( (uint8_t *)(&(data_actual[0])), data_actual.size() ); 49 | 50 | auto t2 = std::chrono::high_resolution_clock::now(); 51 | auto duration = std::chrono::duration_cast( t2 - t1 ).count(); 52 | 53 | std::cout << "Parsing took " << duration << " micro-seconds" << std::endl; 54 | }catch( std::exception &e ) 55 | { 56 | std::cerr << "Caught exception: " << e.what() << std::endl; 57 | }//try / catch 58 | 59 | return EXIT_SUCCESS; 60 | }// int main(argc,argv) 61 | -------------------------------------------------------------------------------- /regression_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_policy(SET CMP0048 NEW) 2 | project(SpecUtilsRegressionTest VERSION 1) 3 | 4 | cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) 5 | 6 | if( NOT SpecUtils_ENABLE_EQUALITY_CHECKS ) 7 | message( FATAL_ERROR "SpecUtils_ENABLE_EQUALITY_CHECKS must be enabled when building regression_test executable" ) 8 | endif( NOT SpecUtils_ENABLE_EQUALITY_CHECKS ) 9 | 10 | add_executable( regression_test regression_test.cpp ) 11 | 12 | target_link_libraries( regression_test PUBLIC SpecUtils ) 13 | 14 | set_target_properties( regression_test PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED YES CXX_EXTENSIONS NO ) 15 | 16 | 17 | -------------------------------------------------------------------------------- /unit_tests/test_spec_file_open.cpp: -------------------------------------------------------------------------------- 1 | /* SpecUtils: a library to parse, save, and manipulate gamma spectrum data files. 2 | 3 | Copyright 2018 National Technology & Engineering Solutions of Sandia, LLC 4 | (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. 5 | Government retains certain rights in this software. 6 | For questions contact William Johnson via email at wcjohns@sandia.gov, or 7 | alternative emails of interspec@sandia.gov. 8 | 9 | This library is free software; you can redistribute it and/or 10 | modify it under the terms of the GNU Lesser General Public 11 | License as published by the Free Software Foundation; either 12 | version 2.1 of the License, or (at your option) any later version. 13 | 14 | This library is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | Lesser General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public 20 | License along with this library; if not, write to the Free Software 21 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 22 | */ 23 | 24 | #include 25 | #include 26 | 27 | 28 | #define DOCTEST_CONFIG_IMPLEMENT 29 | #include "doctest.h" 30 | 31 | #include "SpecUtils/SpecFile.h" 32 | #include "SpecUtils/StringAlgo.h" 33 | #include "SpecUtils/Filesystem.h" 34 | 35 | using namespace std; 36 | 37 | // I couldnt quite figure out how to access command line arguments 38 | // from doctest, so we'll just work around it a bit. 39 | vector g_cl_args; 40 | 41 | 42 | int main(int argc, char** argv) 43 | { 44 | for( int i = 0; i < argc; ++i ) 45 | g_cl_args.push_back( argv[i] ); 46 | 47 | return doctest::Context(argc, argv).run(); 48 | } 49 | 50 | 51 | TEST_CASE( "testFileOpen" ) 52 | { 53 | string indir; 54 | 55 | for( size_t i = 1; i < g_cl_args.size(); ++i ) 56 | { 57 | const string arg = g_cl_args[i]; 58 | 59 | if( SpecUtils::istarts_with( arg, "--indir=" ) ) 60 | indir = arg.substr( 8 ); 61 | }//for( int arg = 1; arg < argc; ++ arg ) 62 | 63 | SpecUtils::ireplace_all( indir, "%20", " " ); 64 | 65 | while( indir.size() && indir[0]=='"' ) 66 | indir = indir.substr( 1 ); 67 | while( indir.size() && indir[indir.size()-1]=='"' ) 68 | indir = indir.substr( 0, indir.size()-1 ); 69 | 70 | 71 | CHECK_MESSAGE( !indir.empty(), "No Input directory specified" << indir ); 72 | CHECK_MESSAGE( SpecUtils::is_directory(indir), "Input is not a valid directory: " << indir ); 73 | 74 | vector files = SpecUtils::recursive_ls( indir ); 75 | 76 | MESSAGE( "Input Directory:" << indir ); 77 | 78 | for( size_t i = 0; i < files.size(); ++i ) 79 | { 80 | const string file = files[i]; 81 | 82 | MESSAGE( "Testing file: '" << file << "'" ); 83 | 84 | SpecUtils::SpecFile meas; 85 | const bool loaded = meas.load_file( file, SpecUtils::ParserType::Auto, file ); 86 | CHECK_MESSAGE( loaded, "Failed to load " << file ); 87 | 88 | if( loaded ) 89 | { 90 | const double sum_gamma = meas.gamma_count_sum(); 91 | CHECK_MESSAGE( sum_gamma >= 1.0, "No decoded gammas in " << file ); 92 | } 93 | }//for( size_t i = 0; i < files.size(); ++i ) 94 | 95 | // CHECK( false ); 96 | } 97 | -------------------------------------------------------------------------------- /unit_tests/test_utf8_str_len.cpp: -------------------------------------------------------------------------------- 1 | /* SpecUtils: a library to parse, save, and manipulate gamma spectrum data files. 2 | 3 | Copyright 2018 National Technology & Engineering Solutions of Sandia, LLC 4 | (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. 5 | Government retains certain rights in this software. 6 | For questions contact William Johnson via email at wcjohns@sandia.gov, or 7 | alternative emails of interspec@sandia.gov. 8 | 9 | This library is free software; you can redistribute it and/or 10 | modify it under the terms of the GNU Lesser General Public 11 | License as published by the Free Software Foundation; either 12 | version 2.1 of the License, or (at your option) any later version. 13 | 14 | This library is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | Lesser General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public 20 | License along with this library; if not, write to the Free Software 21 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 33 | #include "doctest.h" 34 | 35 | #include "SpecUtils/StringAlgo.h" 36 | 37 | using namespace std; 38 | 39 | void check_str( const std::string str, const size_t ncharacters ) 40 | { 41 | const size_t ncounted = SpecUtils::utf8_str_len( str.c_str(), str.size() ); 42 | CHECK_MESSAGE( ncharacters == ncounted, "Failed on string '" << str << "' with getting " << ncounted << " but expected " << ncharacters ); 43 | } 44 | 45 | TEST_CASE( "Testing utf8 strlen" ) 46 | { 47 | //With MSVC 2017, even with adding the /utf-8 definition, string literals like u8"÷aõa" 48 | // are not interpreted by the compiler right (or rather, how I would like - e.g., like 49 | // clang and gcc does), so will specify hex values 50 | check_str( "", 0 ); 51 | check_str( "A", 1 ); 52 | check_str( "AAA", 3 ); 53 | check_str( "\xc3\xb7\x61\xc3\xb5\x61", 4 ); //u8"÷aõa" 54 | check_str( "\xe2\x93\xa7\xe2\x93\xa7\x61\x61\x61", 5 ); //u8"ⓧⓧaaa" 55 | check_str( "\x61\xe2\x93\xa7\xe2\x93\xa7\x61\x61\x61", 6 ); //u8"aⓧⓧaaa" 56 | check_str( "\x61\xe2\x93\xa7\x61\xe2\x93\xa7\x61\x61\x61", 7 ); //u8"aⓧaⓧaaa" 57 | check_str( "\x61\xe2\x93\xa7\x0a\xe2\x93\xa7\x61\x61\x61", 7 ); //u8"aⓧ\nⓧaaa" 58 | check_str( "\x61\xe2\x93\xa7\x0a\xe2\x93\xa7\x61\x61\x61\xc3\xb7", 8 ); //u8"aⓧ\nⓧaaa÷" 59 | check_str( "\x61\xe2\x93\xa7\x0a\xe2\x93\xa7\x61\x61\x61\xc3\xb7\x0a", 9 ); //u8"aⓧ\nⓧaaa÷\n" 60 | } 61 | --------------------------------------------------------------------------------