Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functionality to Remove Test Cases, Inputs, and Outputs in Test Bench Panel #383

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 44 additions & 4 deletions src/components/Panels/TestBenchPanel/TestBenchCreator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@

</div>
<div class="testRow fullTestRow space">
<span>Inputs</span> <span @mousedown="increInputs" class="plusBtn">+</span>
<span>Inputs</span> <span @mousedown="increInputs" class="plusMinusBtn">+</span>
</div>
<div class="testRow fullTestRow space">
<span>Outputs</span> <span @mousedown="increOutputs" class="plusBtn">+</span>
<span>Outputs</span> <span @mousedown="increOutputs" class="plusMinusBtn">+</span>
</div>
</div>
<div class="testCol">
Expand All @@ -42,18 +42,20 @@
<div v-for="(_, i) in inputsName" class="testRow"
:style="{ width: 100 / inputsBandWidth.length + '%' }">
<input class="inputField dataGroupTitle smInputName" type="text" v-model="inputsName[i]" />
<span @mousedown="deleteInput(i)" class="plusMinusBtn">-</span>
</div>
</div>
<div class="testContainer">
<div v-for="(_, i) in outputsName" class="testRow"
:style="{ width: 100 / outputsBandWidth.length + '%' }">
<input class="inputField dataGroupTitle smInputName" type="text" v-model="outputsName[i]" />
<span @mousedown="deleteOutput(i)" class="plusMinusBtn">-</span>
</div>
</div>
</div>
<div class="testCol">
<div class="testRow firstCol">
Bandwidth
Bitwidth
</div>
<div class="testContainer">
<div v-for="(_, i) in inputsBandWidth" class="testRow"
Expand All @@ -77,6 +79,7 @@

<div v-for="(_, index) in group.inputs[0]" class="groupRow" :key="index">
<div class="testRow firstCol spaceArea"></div>
<span @mousedown="deleteTestFromGroup(groupIndex, index)" class="plusMinusBtn">-</span>
<div class="testContainer">
<div v-for="(_, i) in group.inputs" class="testRow colWise"
:style="{ width: 100 / inputsBandWidth.length + '%' }">
Expand Down Expand Up @@ -273,6 +276,16 @@ const addTestToGroup = (index: number) => {
}
};

const deleteTestFromGroup = (groupIndex: number, testIndex: number) => {
groups[groupIndex].inputs.forEach(input => {
input.splice(testIndex, 1);
});

groups[groupIndex].outputs.forEach(output => {
output.splice(testIndex, 1);
});
};

const addNewGroup = () => {
groups.push({
title: `Group ${groups.length + 1}`,
Expand All @@ -296,6 +309,18 @@ const increInputs = () => {
inputsName.value.push(`inp${inputsName.value.length + 1}`);
};

const deleteInput = (index:number) => {
if(inputsName.value.length === 1) return;
groups.forEach((group) => {
if (group.inputs.length === 0) return;

group.inputs.splice(index, 1);
});

inputsBandWidth.value.splice(index, 1);
inputsName.value.splice(index, 1);
};

const increOutputs = () => {
groups.forEach((group) => {
if (group.outputs.length === 0) return;
Expand All @@ -311,6 +336,18 @@ const increOutputs = () => {
outputsName.value.push(`out${outputsName.value.length + 1}`);
};

const deleteOutput = (index:number) => {
if(outputsName.value.length === 1) return;
groups.forEach((group) => {
if (group.outputs.length === 0) return;

group.outputs.splice(index, 1);
});

outputsBandWidth.value.splice(index, 1);
outputsName.value.splice(index, 1);
};

const exportAsCSV = () => {
let csv = `${testType.value},${testTitle.value}\n`;

Expand Down Expand Up @@ -503,7 +540,10 @@ const importFromCSV = () => {
justify-content: center;
}

.plusBtn {
.plusMinusBtn {
align-self: center;
text-align: center;
width: 16px;
cursor: pointer;
padding: 2px;
padding-top: 0.5px;
Expand Down
Loading