Skip to content

Commit

Permalink
Merge pull request #23 from shimwell/adding_a_few_minimal_value_tests
Browse files Browse the repository at this point in the history
added minimal test for DD, DT neutron energy
  • Loading branch information
aidancrilly authored Mar 22, 2024
2 parents 8e48548 + 03c077c commit 387bc1d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
- name: install package with testing dependencies
run: |
pip install .[test]
pytest
- name: run examples
run: |
Expand Down
36 changes: 36 additions & 0 deletions tests/test_core.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import pytest
import NeSST as nst


def test_DTprimspecmoments_mean():
# checks the mean value of the neutron emitted by DT fusion

DTmean, _ = nst.DTprimspecmoments(Tion=5.0) # units KeV

assert DTmean == pytest.approx(14.1, abs=0.1) # units MeV


def test_DDprimspecmoments_mean():
# checks the mean value of the neutron emitted by DD fusion

DDmean, _ = nst.DDprimspecmoments(Tion=5.0) # units KeV

assert DDmean == pytest.approx(2.5, abs=0.1) # units MeV


def test_DDprimspecmoments_mean_with_tion():
# checks the energy of the neutron increases with ion temperature

DDmean_cold, _ = nst.DDprimspecmoments(Tion=5.0) # units KeV
DDmean_hot, _ = nst.DDprimspecmoments(Tion=10.0) # units KeV

assert DDmean_cold < DDmean_hot # units MeV


def test_DTprimspecmoments_mean_with_tion():
# checks the energy of the neutron increases with ion temperature

DTmean_cold, _ = nst.DTprimspecmoments(Tion=5.0) # units KeV
DTmean_hot, _ = nst.DTprimspecmoments(Tion=10.0) # units KeV

assert DTmean_cold < DTmean_hot # units MeV

0 comments on commit 387bc1d

Please sign in to comment.