Skip to content

Commit 61a5920

Browse files
author
Martin Ruefenacht
committed
Added some testing!
1 parent 48de8ae commit 61a5920

File tree

3 files changed

+70
-2
lines changed

3 files changed

+70
-2
lines changed

src/pympistandard/symbol.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ class Symbol:
1414
access to the name and expressibility of the Symbol.
1515
"""
1616

17-
def __init__(self, name: str, apis: Mapping) -> None:
17+
def __init__(self, name: str, parseset: Mapping) -> None:
1818
self._name = name
19-
self._parseset = apis
19+
self._parseset = parseset
2020

2121
@property
2222
def name(self) -> str:

tests/conftest.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""
2+
This module contains test fixtures for the entire test suite.
3+
"""
4+
5+
6+
# pylint: disable=redefined-outer-name
7+
8+
9+
import pytest
10+
11+
12+
from pympistandard.storage import KINDS, PROCEDURES
13+
from pympistandard.procedure import Procedure
14+
from pympistandard.kind import Kind
15+
16+
17+
@pytest.fixture(scope="session", autouse=True)
18+
def dataset() -> None:
19+
"""Creates the test parsesets required for all tests."""
20+
21+
KINDS["return"] = Kind("RETURN", "LIS_RETURN", "ISO_C_RETURN", "F90_RETURN", "F08_RETURN")
22+
23+
PROCEDURES["mpi_procedure_name"] = Procedure(
24+
"MPI_Procedure_name",
25+
{
26+
"name": "MPI_Procedure_name",
27+
"return_kind": "RETURN",
28+
"parameters": [],
29+
"attributes": {"c_expressible": True},
30+
},
31+
)

tests/test_iso_c.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"""
2+
This module contains tests related to the ISO C expressions.
3+
"""
4+
5+
6+
# pylint: disable=redefined-outer-name, unused-argument
7+
8+
9+
import pytest
10+
11+
12+
from typing import Mapping
13+
14+
15+
from pympistandard.storage import PROCEDURES
16+
from pympistandard.isoc import ISOCSymbol
17+
18+
19+
@pytest.mark.parametrize(
20+
"procedure_name, expected", [("MPI_Procedure_name", "ISO_C_RETURN MPI_Procedure_name(void)")]
21+
)
22+
def test_iso_c_symbol_string_representation(procedure_name: str, expected: str) -> None:
23+
"""Test the expression of a ISOCSymbol."""
24+
25+
procedure = PROCEDURES[procedure_name]
26+
iso_c_procedure = procedure.express.iso_c
27+
28+
assert str(iso_c_procedure) == expected
29+
30+
31+
@pytest.mark.parametrize(
32+
"kind_name, expected", [("ARGUMENT_LIST", 3)]
33+
)
34+
def test_pointer_expression(kind_name: str, expected: str) -> None:
35+
"""Tests whether the pointer expression of a kind with ISO C is correct."""
36+
37+
raise NotImplementedError

0 commit comments

Comments
 (0)