Skip to content

Commit

Permalink
Adding tests for configuring levels (#1413)
Browse files Browse the repository at this point in the history
* Adding tests for configuring levels

* Updating tests to use floats and use pytest.approx, not round

* Updating new tests to use keyword arguments
  • Loading branch information
ni-jfitzger authored Apr 22, 2020
1 parent e9f8e2a commit db38fab
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/nidigital/system_tests/test_system_nidigital.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,40 @@ def test_write_sequencer_register(multi_instrument_session):
65535)


def test_configure_voltage_levels(multi_instrument_session):
assert multi_instrument_session.vil == pytest.approx(0.0, abs=1e-4)
assert multi_instrument_session.vih == pytest.approx(3.3, rel=1e-3)
assert multi_instrument_session.vol == pytest.approx(1.6, rel=1e-3)
assert multi_instrument_session.voh == pytest.approx(1.7, rel=1e-3)
assert multi_instrument_session.vterm == pytest.approx(2.0, rel=1e-3)
multi_instrument_session.load_pin_map(os.path.join(test_files_base_dir, "pin_map.pinmap"))
multi_instrument_session.pins['site0/PinA', 'site1/PinC'].configure_voltage_levels(
vil=1.0,
vih=2.0,
vol=3.0,
voh=4.0,
vterm=5.0)
assert multi_instrument_session.pins['site0/PinA', 'site1/PinC'].vil == pytest.approx(1.0, rel=1e-3)
assert multi_instrument_session.pins['site0/PinA', 'site1/PinC'].vih == pytest.approx(2.0, rel=1e-3)
assert multi_instrument_session.pins['site0/PinA', 'site1/PinC'].vol == pytest.approx(3.0, rel=1e-3)
assert multi_instrument_session.pins['site0/PinA', 'site1/PinC'].voh == pytest.approx(4.0, rel=1e-3)
assert multi_instrument_session.pins['site0/PinA', 'site1/PinC'].vterm == pytest.approx(5.0, rel=1e-3)


def test_configure_active_load_levels(multi_instrument_session):
assert multi_instrument_session.active_load_iol == pytest.approx(0.0015, rel=1e-3)
assert multi_instrument_session.active_load_ioh == pytest.approx(-0.0015, rel=1e-3)
assert multi_instrument_session.active_load_vcom == pytest.approx(2.0, rel=1e-3)
multi_instrument_session.load_pin_map(os.path.join(test_files_base_dir, "pin_map.pinmap"))
multi_instrument_session.pins['site0/PinA', 'site1/PinC'].configure_active_load_levels(
iol=0.024,
ioh=-0.024,
vcom=3.0)
assert multi_instrument_session.pins['site0/PinA', 'site1/PinC'].active_load_iol == pytest.approx(0.024, rel=1e-3)
assert multi_instrument_session.pins['site0/PinA', 'site1/PinC'].active_load_ioh == pytest.approx(-0.024, rel=1e-3)
assert multi_instrument_session.pins['site0/PinA', 'site1/PinC'].active_load_vcom == pytest.approx(3.0, rel=1e-3)


def test_specifications_levels_and_timing_single(multi_instrument_session):
pinmap = get_test_file_path('specifications_levels_and_timing_single', 'pin_map.pinmap')
specs = get_test_file_path('specifications_levels_and_timing_single', 'specs.specs')
Expand Down

0 comments on commit db38fab

Please sign in to comment.