コード例 #1
0
    public static void TC_CrashDetectionWhileEngineOff()
    {
        // Initialize signals
        Report.TestStep("Initialize all signals...");
        LockingTestLibrary.ResetLockingTestSignals();

        // Set lock state to locked
        Report.TestStep("Set initial lock state to locked...");
        LockRequest.Value   = LockRequest.Request_lock;
        EngineRunning.Value = 0;
        Velocity.Value      = 0;
        Execution.Wait(LockRequestWaitTime.GetValue());

        // Simulate crash
        Report.TestStep("Simulate crash...");
        CrashDetected.Value = 1;
        Execution.Wait(CrashDetectionWaitingTime.GetValue());

        // Check lock state is locked
        Report.TestStep("Check expected lock state to be locked.");
        if (LockState.Value != LockState.Locked)
        {
            Report.TestStepFail("Lock state is 'unlocked'. Expected lock state is 'locked'.");
        }
        else
        {
            Report.TestStepPass("Lock state is 'locked' as expected.");
        }

        // Reset signals
        Report.TestStep("Rest all signals...");
        LockingTestLibrary.ResetLockingTestSignals();
    }
コード例 #2
0
    public static void TC_ApplyCrashWithDifferentVelocities(int engineRunning, int velocity)
    {
        // Initialize the system
        Report.TestStep("Initialize the system...");
        LockingTestLibrary.ResetLockingTestSignals();

        EngineRunning.Value = engineRunning;

        Report.TestStep("Set initial state 'locked'.");
        LockRequest.Value = LockRequest.Request_lock;
        Execution.Wait(500);

        Report.TestStep("Set velocity to execute test with...");
        Velocity.Value = velocity;
        Execution.Wait(500);

        // Simulate crash
        Report.TestStep("Simulate crash...");
        CrashDetected.Value = 1;
        Execution.Wait(CrashDetectionWaitingTime.GetValue());

        // Check lock state is unlocked
        Report.TestStep("Check expected lock state to be unlocked.");
        if (LockState.Value != LockState.Unlocked)
        {
            Report.TestStepFail("Lock state is 'locked'. Expected lock state is 'unlocked'.");
        }
        else
        {
            Report.TestStepPass("Lock state is 'unlocked' as expected.");
        }

        // Reset signals
        Report.TestStep("Rest all signals...");
        LockingTestLibrary.ResetLockingTestSignals();
    }
コード例 #3
0
    public static void CrashDetection(int engineOn, double velocity)
    {
        // Initialize signals
        Report.TestStep("Initialize all signals...");
        ResetLockingTestSignals();

        // Set lock state to locked
        Report.TestStep("Set initial lock state to locked...");
        EngineRunning.Value = engineOn;
        Velocity.Value      = velocity;
        LockRequest.Value   = LockRequest.Request_lock;
        Execution.Wait(LockRequestWaitTime.GetValue());

        // Simulate crash
        Report.TestStep("Simulate crash...");
        CrashDetected.Value = 1;
        Execution.Wait(CrashDetectionWaitingTime.GetValue());

        // Check lock state is unlocked
        Report.TestStep("Check expected lock state to be unlocked.");
        if (LockState.Value != LockState.Unlocked)
        {
            Report.TestStepFail("Lock state is 'locked'. Expected lock state is 'unlocked'.");
        }
        else
        {
            Report.TestStepPass("Lock state is 'unlocked' as expected.");
        }

        // Check if the car remains opened, even if the velocity increases to higher than the lock-velocity
        if (engineOn == 1)
        {
            Report.TestStep("Check if the car remains opened, even if the velocity increases to higher than the lock-velocity");

            // Increase velocity to a higher value than lock-velocity

            double increasedVelocity = velocity + 10;
            if (increasedVelocity < LockVelocity.GetValue())
            {
                increasedVelocity = LockVelocity.GetValue() + 10;
            }

            Report.TestStep("Increase velocity: Set velocity to " + increasedVelocity);
            Velocity.Value = increasedVelocity;
            Execution.Wait(CrashDetectionWaitingTime.GetValue());

            // Check lock state is still unlocked
            Report.TestStep("Check expected lock state to be unlocked.");
            if (LockState.Value != LockState.Unlocked)
            {
                Report.TestStepFail("Lock state is 'locked'. Expected lock state is 'unlocked'.");
            }
            else
            {
                Report.TestStepPass("Lock state is 'unlocked' as expected.");
            }
        }

        // Reset signals
        Report.TestStep("Rest all signals...");
        ResetLockingTestSignals();
    }