Initial commit

This commit is contained in:
2026-02-26 17:41:05 +01:00
commit 3945b687d4
30 changed files with 2498 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
{
"Tests": [
{
"Name": "Test_Level_Simple",
"Configurations": [
{
"Option": "",
"PinType": "single"
},
{
"Option": "",
"PinType": "ganged"
},
{
"Option": "highCurrent",
"PinType": "single"
},
{
"Option": "highCurrent",
"PinType": "ganged"
}
]
}
]
}

View File

@@ -0,0 +1,32 @@
{
"Instruments": [
{
"InstrumentName": "pin1",
"Variant": "AVI64",
"Option": [],
"PinType": "single",
"PinNumbers": ["1"]
},
{
"InstrumentName": "pin1",
"Variant": "AVI64",
"Option": [],
"PinType": "ganged",
"PinNumbers": ["1","2"]
},
{
"InstrumentName": "pin1",
"Variant": "AVI64",
"Option": ["highCurrent"],
"PinType": "single",
"PinNumbers": ["1"]
},
{
"InstrumentName": "meas1",
"Variant": "AVI64",
"Option": [],
"PinType": "single",
"PinNumbers": ["2"]
}
]
}

View File

@@ -0,0 +1,60 @@
{
"Options": [
"", "highCurrent"
],
"FileNotes" : [""],
"Variables": [
{"$clampCurrent": "0.05*$gangCount"},
{"$irange": "0.06*$gangCount"},
{"$irangeExp": "0.1*$gangCount"}
],
"TestSetups" :
[
{
"Setup" :
{
"Name": "Simple_Typ",
"Notes" : [""],
"InstrumentSetup" : {
"Name": "pin1",
"Properties": [
{ "level.iclampSource": "$clampCurrent" },
{ "level.iclampSink": "$clampCurrent" },
{ "level.irange": "$irange" }
]
}
}
},
{
"Setup" :
{
"Name": "Simple2_Typ",
"Notes" : [""],
"InstrumentSetup" : {
"Name": "pin1",
"Properties": [
{ "level.vrange": "2.0" },
{ "level.iclampSource": "-" }
],
"Expects": [
{ "type" : "state", "checks" :[
{"property" : "iclampSource" , "value" : "$clampCurrent" },
{"property" : "iclampSink" , "value" : "$clampCurrent" },
{"property" : "irange" , "value" : "$irangeExp" },
{"property" : "vrange" , "value" : "3.0" }
]
},
{ "type" : "logset", "checks" :[
{"logset" : "avi64.DcRangeLogicalSet", "properties" : [
{ "property" : "vrange" , "value" : "3.0"},
{ "property" : "irange" , "value" : "$irangeExp"}
]
}
]
}
]
}
}
}
]
}

View File

@@ -0,0 +1,54 @@
#ifndef INSTRUMENTS_H
#define INSTRUMENTS_H
#include <string>
#include <vector>
struct Instruments {
std::string variant;
std::vector<std::string> options;
std::string pinType;
std::vector<int> pinNumbers;
int gangCount;
static Instruments pin1_single() {
Instruments inst;
inst.variant = "AVI64";
inst.pinType = "single";
inst.pinNumbers.push_back(1);
inst.gangCount = 1;
return inst;
}
static Instruments pin1_ganged() {
Instruments inst;
inst.variant = "AVI64";
inst.pinType = "ganged";
inst.pinNumbers.push_back(1);
inst.pinNumbers.push_back(2);
inst.gangCount = 2;
return inst;
}
static Instruments pin1_single_highCurrent() {
Instruments inst;
inst.variant = "AVI64";
inst.options.push_back("highCurrent");
inst.pinType = "single";
inst.pinNumbers.push_back(1);
inst.gangCount = 1;
return inst;
}
static Instruments meas1_single() {
Instruments inst;
inst.variant = "AVI64";
inst.pinType = "single";
inst.pinNumbers.push_back(2);
inst.gangCount = 1;
return inst;
}
};
#endif

View File

@@ -0,0 +1,18 @@
# Makefile for generated tests
CXX = g++
CXXFLAGS = -std=c++11 -Wall -O2
TARGET = test_runner
all: $(TARGET)
$(TARGET): main.cpp Instruments.h Measurement.h Test_Level_Simple.cpp
$(CXX) $(CXXFLAGS) -o $(TARGET) main.cpp
clean:
rm -f $(TARGET) $(TARGET).exe
run: $(TARGET)
./$(TARGET)
.PHONY: all clean run

View File

@@ -0,0 +1,31 @@
#ifndef MEASUREMENT_H
#define MEASUREMENT_H
#include "Instruments.h"
class Measurement {
public:
Measurement(const Instruments& inst) {}
void build(bool flag) {}
void execute(bool flag) {}
void ProblemCheck() {}
void StateCheck() {}
void LogSetCheck() {}
// Property setters
template<typename T>
void level_vforce(const std::string& name, T value) {}
template<typename T>
void level_iclampSource(const std::string& name, T value) {}
template<typename T>
void level_iclampSink(const std::string& name, T value) {}
template<typename T>
void level_vrange(const std::string& name, T value) {}
template<typename T>
void level_irange(const std::string& name, T value) {}
void connect(bool flag) {}
void disconnect(bool flag) {}
void disconnectMode(const std::string& mode) {}
};
#endif

View File

@@ -0,0 +1,44 @@
# Generated Test Files
This directory contains automatically generated C++ test code.
## Files
- `Instruments.h` - Instrument configuration definitions
- `Measurement.h` - Measurement interface (stub implementation)
- `Test_Level_Simple.cpp` - Test class: Test_Level_Simple
- `main.cpp` - Main entry point that executes all tests
- `build.bat` - Windows build script
- `Makefile` - Linux/Mac build script
## Building
**Windows:**
```bash
build.bat
```
**Linux/Mac:**
```bash
make
```
## Running
After building, run the tests:
**Windows:**
```bash
test_runner.exe
```
**Linux/Mac:**
```bash
./test_runner
```
## Note
The `Measurement.h` file contains stub implementations. You should replace
this with your actual measurement implementation or link against your
measurement library when building the tests.

View File

@@ -0,0 +1,57 @@
#include "Instruments.h"
#include "Measurement.h"
// Test class generated from template: auto_generated
class Test_Level_Simple {
public:
void Simple_Typ(Measurement& measurement, int gangCount) {
// Setup: Simple_Typ
double clampCurrent = 0.05*gangCount;
double forceValue = 1.0;
double irange = 0.06*gangCount;
double irangeExp = 0.1*gangCount;
measurement.level_vforce("pin1", 1.0);
measurement.level_iclampSource("pin1", clampCurrent);
measurement.level_iclampSink("pin1", clampCurrent);
measurement.level_vrange("pin1", 0.0);
measurement.level_irange("pin1", irange);
measurement.connect(true);
measurement.disconnect(true);
measurement.disconnectMode("hiz");
}
void Simple2_Typ(Measurement& measurement, int gangCount) {
// Setup: Simple2_Typ
double clampCurrent = 0.05*gangCount;
double forceValue = 1.0;
double irange = 0.06*gangCount;
double irangeExp = 0.1*gangCount;
measurement.level_vrange("pin1", 2.0);
}
void run(const Instruments& instruments) {
int gangCount = instruments.gangCount;
// createMeasurement
Measurement MeasurementObj(instruments);
// applySetup
Simple_Typ(MeasurementObj, gangCount);
// buildMeasurement
MeasurementObj.build(false);
// ProblemCheck
MeasurementObj.ProblemCheck();
// applySetup
Simple2_Typ(MeasurementObj, gangCount);
// buildMeasurement
MeasurementObj.build(true);
// executeMeasurement
MeasurementObj.execute(true);
// StateCheck
MeasurementObj.StateCheck();
// LogSetCheck
MeasurementObj.LogSetCheck();
}
};

View File

@@ -0,0 +1,18 @@
@echo off
REM Build script for generated tests
echo Building generated tests...
echo Compiling main.cpp...
g++ -std=c++11 -Wall -O2 -o test_runner.exe main.cpp
if errorlevel 1 (
echo.
echo Build failed!
exit /b 1
)
echo.
echo Build successful! Executable: test_runner.exe
echo.
echo To run the tests, execute: test_runner.exe

View File

@@ -0,0 +1,34 @@
#include <iostream>
#include "Instruments.h"
#include "Test_Level_Simple.cpp"
int main() {
std::cout << "Running generated tests..." << std::endl;
{
Test_Level_Simple test;
test.run(Instruments::pin1_single());
std::cout << "Completed: Test_Level_Simple with pin1_single" << std::endl;
}
{
Test_Level_Simple test;
test.run(Instruments::pin1_ganged());
std::cout << "Completed: Test_Level_Simple with pin1_ganged" << std::endl;
}
{
Test_Level_Simple test;
test.run(Instruments::pin1_single_highCurrent());
std::cout << "Completed: Test_Level_Simple with pin1_single_highCurrent" << std::endl;
}
{
Test_Level_Simple test;
test.run(Instruments::meas1_single());
std::cout << "Completed: Test_Level_Simple with meas1_single" << std::endl;
}
std::cout << "All tests completed." << std::endl;
return 0;
}

View File

@@ -0,0 +1,45 @@
// Auto-generated instrument definitions - do not edit
#pragma once
#include <vector>
// Instrument definitions
struct InstrumentDef {
std::string name;
std::string variant;
std::vector<std::string> options;
std::string pinType;
std::vector<int> pinNumbers;
};
// All configured instruments
static const std::vector<InstrumentDef> allInstruments = {
{
"pin1", // name
"AVI64", // variant
{}, // options
"single", // pinType
{1} // pinNumbers
},
{
"pin1", // name
"AVI64", // variant
{}, // options
"ganged", // pinType
{1, 2} // pinNumbers
},
{
"pin1", // name
"AVI64", // variant
{"highCurrent"}, // options
"single", // pinType
{1} // pinNumbers
},
{
"meas1", // name
"AVI64", // variant
{}, // options
"single", // pinType
{2} // pinNumbers
}
};

View File

@@ -0,0 +1,66 @@
// Auto-generated test file - do not edit
// Test: Test_Level_Simple
class Test_Level_Simple {
public:
Test_Level_Simple(Instruments instruments)
: instruments_(instruments) {}
// Setup method: Simple_Typ
void setup_Simple_Typ(Measurement measurement) {
// Variables
double clampCurrent = 0.05*gangCount;
double irange = 0.06*gangCount;
double irangeExp = 0.1*gangCount;
double forceValue = 1.0;
// Properties for pin1
setProperty(measurement, "pin1", "disconnectMode", "hiz");
setProperty(measurement, "pin1", "level.iclampSink", clampCurrent);
setProperty(measurement, "pin1", "level.vforce", forceValue);
setProperty(measurement, "pin1", "level.iclampSource", clampCurrent);
setProperty(measurement, "pin1", "level.vrange", 0.0);
setProperty(measurement, "pin1", "level.irange", irange);
setProperty(measurement, "pin1", "connect", true);
setProperty(measurement, "pin1", "disconnect", true);
checkProblem(measurement, "pin1", "The " + std::to_string(forceValue) + " exceeds the level.vrange*");
}
// Setup method: Simple2_Typ
void setup_Simple2_Typ(Measurement measurement) {
// Variables
double clampCurrent = 0.05*gangCount;
double irange = 0.06*gangCount;
double irangeExp = 0.1*gangCount;
double forceValue = 1.0;
// Properties for pin1
setProperty(measurement, "pin1", "level.vrange", 2.0);
checkState(measurement, "pin1", "iclampSource", clampCurrent);
checkState(measurement, "pin1", "iclampSink", clampCurrent);
checkState(measurement, "pin1", "irange", irangeExp);
checkState(measurement, "pin1", "vrange", 3.0);
checkLogset(measurement, "pin1", "avi64.DcRangeLogicalSet", "vrange", 3.0);
checkLogset(measurement, "pin1", "avi64.DcRangeLogicalSet", "irange", irangeExp);
}
// Execute test sequence
void execute() {
auto Measurement = createMeasurement(instruments_);
setup_Simple_Typ(Measurement);
buildMeasurement(Measurement, false);
ProblemCheck(Measurement, "Simple_Typ");
setup_Simple2_Typ(Measurement);
buildMeasurement(Measurement, true);
executeMeasurement(Measurement, true);
StateCheck(Measurement, "Simple2_Typ");
LogSetCheck(Measurement, "Simple2_Typ");
}
private:
Instruments instruments_;
};

View File

@@ -0,0 +1,20 @@
// Auto-generated main file - do not edit
#include "InstrumentDefs.h"
#include "Test_Level_Simple.cpp"
int main(int argc, char* argv[]) {
// Initialize instruments (implementation specific)
Instruments instruments;
// TODO: Initialize instruments from configuration
// Execute test: Test_Level_Simple
{
Test_Level_Simple test(instruments);
// Call setup methods as needed
// test.setup_<method_name>(instruments);
test.execute();
}
return 0;
}