Initial commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"Tests": [
|
||||
{
|
||||
"Name": "Test_Level_Simple",
|
||||
"Configurations": [
|
||||
{
|
||||
"Option": "",
|
||||
"PinType": "single"
|
||||
},
|
||||
{
|
||||
"Option": "",
|
||||
"PinType": "ganged"
|
||||
},
|
||||
{
|
||||
"Option": "highCurrent",
|
||||
"PinType": "single"
|
||||
},
|
||||
{
|
||||
"Option": "highCurrent",
|
||||
"PinType": "ganged"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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"}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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.
|
||||
@@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user