Skip to content

Commit

Permalink
Merge pull request #79 from SpiceSharp/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
marcin-golebiowski authored Nov 22, 2018
2 parents f122c0b + fb092c2 commit d1acf43
Show file tree
Hide file tree
Showing 19 changed files with 860 additions and 537 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace SpiceSharpParser.IntegrationTests.AnalogBehavioralModeling
public class TableTests : BaseTests
{
[Fact]
public void ParsingFirstFormat()
public void When_ParsingFirstFormat_Expect_Reference()
{
var netlist = ParseNetlist(
"TABLE circuit",
Expand All @@ -23,7 +23,7 @@ public void ParsingFirstFormat()
}

[Fact]
public void ParsingSecondFormat()
public void When_ParsingSecondFormat_Expect_Reference()
{
var netlist = ParseNetlist(
"TABLE circuit",
Expand All @@ -40,7 +40,7 @@ public void ParsingSecondFormat()
}

[Fact]
public void ParsingThirdFormat()
public void When_ParsingThirdFormat_Expect_Reference()
{
var netlist = ParseNetlist(
"TABLE circuit",
Expand All @@ -57,7 +57,91 @@ public void ParsingThirdFormat()
}

[Fact]
public void ParsingAdvancedExpression()
public void When_ParsingFourthFormat_Expect_Reference()
{
var netlist = ParseNetlist(
"TABLE circuit",
"V1 1 0 1.5m",
"R1 1 0 10",
"E12 2 1 TABLE {V(1,0)} (0 1) (1m,2) (2m,3)",
"R2 2 0 10",
".SAVE V(2,1)",
".OP",
".END");
var export = RunOpSimulation(netlist, "V(2,1)");
Assert.NotNull(netlist);
Assert.Equal(2.5, export);
}

[Fact]
public void When_ParsingFifthFormat_Expect_Reference()
{
var netlist = ParseNetlist(
"TABLE circuit",
"V1 1 0 1.5m",
"R1 1 0 10",
"E12 2 1 TABLE {V(1,0)} ((0 1) (1m,2))(2m,3))",
"R2 2 0 10",
".SAVE V(2,1)",
".OP",
".END");
var export = RunOpSimulation(netlist, "V(2,1)");
Assert.NotNull(netlist);
Assert.Equal(2.5, export);
}

[Fact]
public void When_ParsingSixthFormat_Expect_Reference()
{
var netlist = ParseNetlist(
"TABLE circuit",
"V1 1 0 1.5m",
"R1 1 0 10",
"E12 2 1 TABLE {V(1,0)} ((0 1) (1m,2)((2m,3))",
"R2 2 0 10",
".SAVE V(2,1)",
".OP",
".END");
var export = RunOpSimulation(netlist, "V(2,1)");
Assert.NotNull(netlist);
Assert.Equal(2.5, export);
}

[Fact]
public void When_ParsingSeventhFormat_Expect_Reference()
{
var netlist = ParseNetlist(
"TABLE circuit",
"V1 1 0 1.5m",
"R1 1 0 10",
"E12 2 1 TABLE {V(1,0)} ((0 1)) ((1m,2)(2m,3))",
"R2 2 0 10",
".SAVE V(2,1)",
".OP",
".END");
var export = RunOpSimulation(netlist, "V(2,1)");
Assert.NotNull(netlist);
Assert.Equal(2.5, export);
}
[Fact]
public void When_ParsingEightFormat_Expect_Reference()
{
var netlist = ParseNetlist(
"TABLE circuit",
"V1 1 0 1.5m",
"R1 1 0 10",
"E12 2 1 TABLE {V(1,0)} ((0 1)) ((1m,2)) ((2m,3))",
"R2 2 0 10",
".SAVE V(2,1)",
".OP",
".END");
var export = RunOpSimulation(netlist, "V(2,1)");
Assert.NotNull(netlist);
Assert.Equal(2.5, export);
}

[Fact]
public void When_ParsingAdvancedExpression_Expect_Reference()
{
var netlist = ParseNetlist(
"TABLE circuit",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace SpiceSharpParser.IntegrationTests.AnalogBehavioralModeling
public class ValueTests : BaseTests
{
[Fact]
public void VoltageControlledVoltageSourceSubckt()
public void When_VoltageControlledVoltageSourceIsInsideSubckt_Expect_Reference()
{
var netlist = ParseNetlist(
"Value test circuit",
Expand All @@ -30,7 +30,7 @@ public void VoltageControlledVoltageSourceSubckt()
}

[Fact]
public void VoltageControlledVoltageSourceSubcktSameVoltage()
public void When_TwoVoltageControlledVoltageSourceInSubcktSameVoltage_Expect_Reference()
{
var netlist = ParseNetlist(
"Value test circuit",
Expand Down Expand Up @@ -58,7 +58,7 @@ public void VoltageControlledVoltageSourceSubcktSameVoltage()
}

[Fact]
public void VoltageControlledVoltageSourceValueParsing()
public void When_VoltageControlledVoltageSourceValueValue_Expect_Reference()
{
var netlist = ParseNetlist(
"Value test circuit",
Expand All @@ -74,9 +74,8 @@ public void VoltageControlledVoltageSourceValueParsing()
Assert.Equal(4, export);
}


[Fact]
public void VoltageControlledVoltageSourceValueParsingWithoutEqual()
public void When_VoltageControlledVoltageSourceValueWithoutEqual_Expect_Reference()
{
var netlist = ParseNetlist(
"Value test circuit",
Expand All @@ -92,9 +91,8 @@ public void VoltageControlledVoltageSourceValueParsingWithoutEqual()
Assert.Equal(4, export);
}


[Fact]
public void VoltageControlledVoltageSourceValueSimpleDependency()
public void When_VoltageControlledVoltageSourceValueSimpleDependency_Expect_Reference()
{
var netlist = ParseNetlist(
"Value test circuit",
Expand All @@ -112,7 +110,7 @@ public void VoltageControlledVoltageSourceValueSimpleDependency()
}

[Fact]
public void VoltageControlledVoltageSourceValueLoop()
public void When_VoltageControlledVoltageSourceValueLoop_Expect_Reference()
{
var netlist = ParseNetlist(
"Value test circuit",
Expand All @@ -129,7 +127,7 @@ public void VoltageControlledVoltageSourceValueLoop()
}

[Fact]
public void CurrentControlledVoltageSourceValueParsing()
public void When_CurrentControlledVoltageSourceValueParsing_Expect_Reference()
{
var netlist = ParseNetlist(
"Value test circuit",
Expand All @@ -146,7 +144,7 @@ public void CurrentControlledVoltageSourceValueParsing()
}

[Fact]
public void CurrentControlledVoltageSourceValueParsingWithoutEqual()
public void When_CurrentControlledVoltageSourceValueParsingWithoutEqual_Expect_Reference()
{
var netlist = ParseNetlist(
"Value test circuit",
Expand All @@ -163,7 +161,7 @@ public void CurrentControlledVoltageSourceValueParsingWithoutEqual()
}

[Fact]
public void CurrentControlledVoltageSourceValueSimpleDependency()
public void When_CurrentControlledVoltageSourceValueSimpleDependency_Expect_Reference()
{
var netlist = ParseNetlist(
"Value test circuit",
Expand All @@ -181,7 +179,7 @@ public void CurrentControlledVoltageSourceValueSimpleDependency()
}

[Fact]
public void CurrentControlledVoltageSourceValueLoop()
public void When_CurrentControlledVoltageSourceValueLoop_Expect_Reference()
{
var netlist = ParseNetlist(
"Value test circuit",
Expand All @@ -198,7 +196,7 @@ public void CurrentControlledVoltageSourceValueLoop()
}

[Fact]
public void VoltageSourceValueParsing()
public void When_VoltageSourceValueParsing_Expect_Reference()
{
var netlist = ParseNetlist(
"Value test circuit",
Expand All @@ -215,7 +213,7 @@ public void VoltageSourceValueParsing()
}

[Fact]
public void VoltageSourceValueSimpleDependency()
public void When_VoltageSourceValueSimpleDependency_Expect_Reference()
{
var netlist = ParseNetlist(
"Value test circuit",
Expand All @@ -233,7 +231,7 @@ public void VoltageSourceValueSimpleDependency()
}

[Fact]
public void VoltageSourceValueLoop()
public void When_VoltageSourceValueLoop_Expect_Reference()
{
var netlist = ParseNetlist(
"Value test circuit",
Expand All @@ -250,7 +248,7 @@ public void VoltageSourceValueLoop()
}

[Fact]
public void VoltageSourceParsing()
public void When_VoltageSourceParsing_Expect_Reference()
{
var netlist = ParseNetlist(
"Value test circuit",
Expand All @@ -267,7 +265,24 @@ public void VoltageSourceParsing()
}

[Fact]
public void VoltageSourceSimpleDependency()
public void When_VoltageSourceParsingDifferentFormat_Expect_Reference()
{
var netlist = ParseNetlist(
"Value test circuit",
"R1 1 0 100",
"I1 1 0 2",
"V2 2 0 VALUE { I(I1) + 2 }",
".OP",
".SAVE V(2,0)",
".END");

Assert.NotNull(netlist);
double export = RunOpSimulation(netlist, "V(2,0)");
Assert.Equal(4, export);
}

[Fact]
public void When_VoltageSourceSimpleDependency_Expect_Reference()
{
var netlist = ParseNetlist(
"Value test circuit",
Expand All @@ -285,7 +300,7 @@ public void VoltageSourceSimpleDependency()
}

[Fact]
public void VoltageSourceLoop()
public void When_VoltageSourceLoop_Expect_Reference()
{
var netlist = ParseNetlist(
"Value test circuit",
Expand All @@ -302,7 +317,7 @@ public void VoltageSourceLoop()
}

[Fact]
public void DCVoltageSweep()
public void When_DCVoltageSweep_Expect_Reference()
{
var netlist = ParseNetlist(
"Value - DC Sweep - Voltage",
Expand All @@ -321,7 +336,7 @@ public void DCVoltageSweep()
}

[Fact]
public void TranComplexVoltage()
public void When_TranComplexVoltage_Expect_Reference()
{
var netlist = ParseNetlist(
"Value - TRAN - Voltage TIME",
Expand All @@ -340,7 +355,7 @@ public void TranComplexVoltage()
}

[Fact]
public void CurrentSourceValueParsing()
public void When_CurrentSourceValueParsing_Expect_Reference()
{
var netlist = ParseNetlist(
"Current source value circuit",
Expand All @@ -357,7 +372,24 @@ public void CurrentSourceValueParsing()
}

[Fact]
public void CurrentSourceParsing()
public void When_CurrentSourceValueWithoutEqualParsing_Expect_Reference()
{
var netlist = ParseNetlist(
"Current source value circuit",
"R1 2 0 100",
"I1 1 0 2",
"I2 2 0 VALUE { I(I1) + 2 }",
".OP",
".SAVE I(I2)",
".END");

Assert.NotNull(netlist);
double export = RunOpSimulation(netlist, "I(I2)");
Assert.Equal(4, export);
}

[Fact]
public void When_CurrentSourceParsing_Expect_Reference()
{
var netlist = ParseNetlist(
"Current source value circuit",
Expand All @@ -374,7 +406,7 @@ public void CurrentSourceParsing()
}

[Fact]
public void VoltageControlledCurrentSourceValueParsing()
public void When_VoltageControlledCurrentSourceValueParsing_Expect_Reference()
{
var netlist = ParseNetlist(
"Value test circuit",
Expand All @@ -391,7 +423,7 @@ public void VoltageControlledCurrentSourceValueParsing()
}

[Fact]
public void VoltageControlledCurrentSourceValueParsingWithoutEqual()
public void When_VoltageControlledCurrentSourceValueParsingWithoutEqual_Expect_Reference()
{
var netlist = ParseNetlist(
"Value test circuit",
Expand All @@ -408,7 +440,7 @@ public void VoltageControlledCurrentSourceValueParsingWithoutEqual()
}

[Fact]
public void CurrentControlledCurrentSourceValueParsing()
public void When_CurrentControlledCurrentSourceValueParsing_Expect_Reference()
{
var netlist = ParseNetlist(
"Value test circuit",
Expand All @@ -426,7 +458,7 @@ public void CurrentControlledCurrentSourceValueParsing()
}

[Fact]
public void CurrentControlledCurrentSourceValueParsingWithoutEqual()
public void When_CurrentControlledCurrentSourceValueParsingWithoutEqual_Expect_Reference()
{
var netlist = ParseNetlist(
"Value test circuit",
Expand Down
Loading

0 comments on commit d1acf43

Please sign in to comment.