|
| 1 | +#pragma TextEncoding = "UTF-8" |
| 2 | +#pragma rtGlobals = 3 // Use modern global access method and strict wave access. |
| 3 | +#pragma rtFunctionErrors = 1 |
| 4 | +#pragma ModuleName = UTF_ReplayData |
| 5 | + |
| 6 | +/// @file UTF_ReplayData.ipf |
| 7 | +/// |
| 8 | +/// Overview: |
| 9 | +/// |
| 10 | +/// - ReplayDataTest checks that the replay data feature is disabled by default and does DAQ |
| 11 | +/// - ReplayDataTest_R1 (aka _REENTRY once) checks LBN entries and enables Replay Data |
| 12 | +/// - ReplayDataTest_R2 checks the replay data enabled settings and replays sweep zero |
| 13 | +/// - ReplayDataTest_R3 checks that replaying the data did not result in any differences |
| 14 | +/// - ReplayDataTest_R4 disables replay data again |
| 15 | +/// - ReplayDataTest_R5 checks that |
| 16 | + |
| 17 | +// UTF_TD_GENERATOR DataGenerators#DeviceNameGeneratorMD1 |
| 18 | +static Function ReplayDataTest([string str]) |
| 19 | + |
| 20 | + INFO("REPLAY_DATA is still defined, call DisableReplayData() before.") |
| 21 | + |
| 22 | + REQUIRE(!RD_IsCompilationEnabled()) |
| 23 | + REQUIRE(!RD_IsEnabled()) |
| 24 | + |
| 25 | + [STRUCT ACD_DAQSettings s] = ACD_InitDAQSettingsFromString("MD1_RA0_I0_L0_BKG1" + \ |
| 26 | + "__HS0_DA0_AD0_CM:VC:_ST:StimulusSetA_DA_0:") |
| 27 | + |
| 28 | + ACD_AcquireData(s, str) |
| 29 | +End |
| 30 | + |
| 31 | +static Function ReplayDataTest_REENTRY([string str]) |
| 32 | + |
| 33 | + WAVE numericalValues = GetLBnumericalValues(str) |
| 34 | + |
| 35 | + WAVE/Z settings = GetLastSetting(numericalValues, 0, "Original data", DATA_ACQUISITION_MODE) |
| 36 | + CHECK_WAVE(settings, NUMERIC_WAVE) |
| 37 | + CHECK_EQUAL_WAVES(settings, WaveDouble({NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 1})) |
| 38 | + |
| 39 | + EnableReplayData() |
| 40 | + |
| 41 | + RegisterReentryFunction("UTF_ReplayData#" + GetRTStackInfo(1)) |
| 42 | +End |
| 43 | + |
| 44 | +static Function ReplayDataTest_REENTRY_REENTRY([string str]) |
| 45 | + |
| 46 | + CHECK(RD_IsCompilationEnabled()) |
| 47 | + CHECK(!RD_IsEnabled()) |
| 48 | + |
| 49 | +#ifdef REPLAY_DATA |
| 50 | + KillOrMoveToTrash(dfr = GetReplayStorage()) |
| 51 | + RD_PrepareMIES() |
| 52 | + RD_ReplayData(0) |
| 53 | +#else |
| 54 | + INFO("REPLAY_DATA is not defined") |
| 55 | + FAIL() |
| 56 | +#endif // REPLAY_DATA |
| 57 | + |
| 58 | + RegisterReentryFunction("UTF_ReplayData#" + GetRTStackInfo(1)) |
| 59 | +End |
| 60 | + |
| 61 | +static Function ReplayDataTest_REENTRY_REENTRY_REENTRY([string str]) |
| 62 | + |
| 63 | + WAVE numericalValues = GetLBnumericalValues(str) |
| 64 | + |
| 65 | + WAVE/Z settings = GetLastSetting(numericalValues, 0, "Original data", DATA_ACQUISITION_MODE) |
| 66 | + CHECK_WAVE(settings, NUMERIC_WAVE) |
| 67 | + CHECK_EQUAL_WAVES(settings, WaveDouble({NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 0})) |
| 68 | + |
| 69 | +#ifdef REPLAY_DATA |
| 70 | + CHECK_EQUAL_VAR(RD_CompareRAC(), 0) |
| 71 | + CHECK_EQUAL_VAR(RD_CompareSCI(), 0) |
| 72 | + CHECK_EQUAL_VAR(RD_CompareLabnotebooks(), 0) |
| 73 | +#else |
| 74 | + INFO("REPLAY_DATA is not defined") |
| 75 | + FAIL() |
| 76 | +#endif // REPLAY_DATA |
| 77 | + |
| 78 | + RegisterReentryFunction("UTF_ReplayData#" + GetRTStackInfo(1)) |
| 79 | +End |
| 80 | + |
| 81 | +static Function ReplayDataTest_REENTRY_REENTRY_REENTRY_REENTRY([string str]) |
| 82 | + |
| 83 | + DisableReplayData() |
| 84 | + |
| 85 | + RegisterReentryFunction("UTF_ReplayData#" + GetRTStackInfo(1)) |
| 86 | +End |
| 87 | + |
| 88 | +static Function ReplayDataTest_REENTRY_REENTRY_REENTRY_REENTRY_REENTRY([string str]) |
| 89 | + |
| 90 | + CHECK(!RD_IsCompilationEnabled()) |
| 91 | + // because REPLAY_DATA is not defined anymore, also the replay enable knob is disabled |
| 92 | + CHECK(!RD_IsEnabled()) |
| 93 | + // although GetReplayDataEnable() would still return true |
| 94 | +End |
0 commit comments