All files / server/mocks/arduino-mock arduino-registry.ts

100% Statements 2/2
100% Branches 0/0
100% Functions 0/0
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44                    16x                                     16x                            
/**
 * Arduino Registry and Helper Structures
 * 
 * This file exports the C++ code for I/O registry tracking structures
 * and operations used during Arduino simulation.
 */
 
/**
 * I/O Registry tracking structures - for tracking pin usage patterns
 */
export const ARDUINO_REGISTRY_STRUCTURES = `
// Runtime I/O Registry tracking
struct IOOperation {
    int line;
    std::string operation;
};
 
struct IOPinRecord {
    std::string pin;
    bool defined;
    int definedLine;
    int pinMode;  // 0=INPUT, 1=OUTPUT, 2=INPUT_PULLUP
    std::vector<IOOperation> operations;
};
`;
 
/**
 * Pin state tracking initialization code
 */
export const ARDUINO_PIN_STATE_INIT = `
// Pin state tracking for visualization
static int pinModes[20] = {0};   // 0=INPUT, 1=OUTPUT, 2=INPUT_PULLUP
static std::atomic<int> pinValues[20];  // Thread-safe: Digital 0=LOW, 1=HIGH
 
// Initialize atomic array (called before main)
struct PinValuesInitializer {
    PinValuesInitializer() {
        for (int i = 0; i < 20; i++) {
            pinValues[i].store(0);
        }
    }
} pinValuesInit;
`;