Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
32dd661b
Commit
32dd661b
authored
Oct 01, 2013
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unit test: add tests for Topology 01 to 17
parent
5ff7bac1
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
971 additions
and
0 deletions
+971
-0
dream/test/dump/Topology01.result
dream/test/dump/Topology01.result
+97
-0
dream/test/dump/Topology02.result
dream/test/dump/Topology02.result
+36
-0
dream/test/dump/Topology03.result
dream/test/dump/Topology03.result
+45
-0
dream/test/dump/Topology04.result
dream/test/dump/Topology04.result
+45
-0
dream/test/dump/Topology05.result
dream/test/dump/Topology05.result
+46
-0
dream/test/dump/Topology06.result
dream/test/dump/Topology06.result
+55
-0
dream/test/dump/Topology07.result
dream/test/dump/Topology07.result
+47
-0
dream/test/dump/Topology08.result
dream/test/dump/Topology08.result
+57
-0
dream/test/dump/Topology09.result
dream/test/dump/Topology09.result
+27
-0
dream/test/dump/Topology10.result
dream/test/dump/Topology10.result
+57
-0
dream/test/dump/Topology11.result
dream/test/dump/Topology11.result
+55
-0
dream/test/dump/Topology12.result
dream/test/dump/Topology12.result
+65
-0
dream/test/dump/Topology13.result
dream/test/dump/Topology13.result
+54
-0
dream/test/dump/Topology14.result
dream/test/dump/Topology14.result
+74
-0
dream/test/dump/Topology15.result
dream/test/dump/Topology15.result
+54
-0
dream/test/dump/Topology16.result
dream/test/dump/Topology16.result
+64
-0
dream/test/dump/Topology17.result
dream/test/dump/Topology17.result
+37
-0
dream/test/testSimulationTopology.py
dream/test/testSimulationTopology.py
+56
-0
No files found.
dream/test/dump/Topology01.result
0 → 100644
View file @
32dd661b
{
"elementList": [
{
"_class": "Dream.Exit",
"id": "E1",
"results": {
"taktTime": {
"max": 1.965846994535519,
"avg": 1.965846994535519,
"min": 1.965846994535519
},
"throughput": {
"max": 732,
"avg": 732,
"min": 732
},
"lifespan": {
"max": 7.646516393442623,
"avg": 7.646516393442623,
"min": 7.646516393442623
}
}
},
{
"_class": "Dream.Machine",
"id": "M1",
"results": {
"working_ratio": {
"max": 12.760416666666666,
"avg": 12.760416666666666,
"min": 12.760416666666666
},
"blockage_ratio": {
"max": 78.17708333333333,
"avg": 78.17708333333333,
"min": 78.17708333333333
},
"failure_ratio": {
"max": 9.027777777777779,
"avg": 9.027777777777779,
"min": 9.027777777777779
},
"waiting_ratio": {
"max": 0.034722222222222224,
"avg": 0.034722222222222224,
"min": 0.034722222222222224
}
}
},
{
"_class": "Dream.Machine",
"id": "M2",
"results": {
"working_ratio": {
"max": 76.31944444444444,
"avg": 76.31944444444444,
"min": 76.31944444444444
},
"blockage_ratio": {
"max": 0.0,
"avg": 0.0,
"min": 0.0
},
"failure_ratio": {
"max": 19.791666666666668,
"avg": 19.791666666666668,
"min": 19.791666666666668
},
"waiting_ratio": {
"max": 3.888888888888889,
"avg": 3.888888888888889,
"min": 3.888888888888889
}
}
},
{
"_class": "Dream.Repairman",
"id": "W1",
"results": {
"working_ratio": {
"max": 26.73611111111111,
"avg": 26.73611111111111,
"min": 26.73611111111111
},
"waiting_ratio": {
"max": 73.26388888888889,
"avg": 73.26388888888889,
"min": 73.26388888888889
}
}
}
],
"_class": "Dream.Simulation",
"general": {
"_class": "Dream.Configuration"
}
}
\ No newline at end of file
dream/test/dump/Topology02.result
0 → 100644
View file @
32dd661b
{
"elementList": [
{
"_class": "Dream.Assembly",
"id": "A1",
"results": {
"working_ratio": 92.36111111111111,
"blockage_ratio": 7.534722222222222,
"waiting_ratio": 0.10416666666666667
}
},
{
"_class": "Dream.Exit",
"id": "E1",
"results": {
"throughput": 664,
"takt_time": 2.166039156626506,
"lifespan": 55.327560240963855
}
},
{
"_class": "Dream.Machine",
"id": "M1",
"results": {
"working_ratio": 11.527777777777779,
"blockage_ratio": 0.0,
"failure_ratio": 7.638888888888889,
"waiting_ratio": 80.83333333333333
}
}
],
"_class": "Dream.Simulation",
"general": {
"_class": "Dream.Configuration"
}
}
\ No newline at end of file
dream/test/dump/Topology03.result
0 → 100644
View file @
32dd661b
{
"elementList": [
{
"_class": "Dream.Exit",
"id": "E1",
"results": {
"throughput": 712,
"takt_time": 2.021067415730337,
"lifespan": 5.93433988764045
}
},
{
"_class": "Dream.Machine",
"id": "M1",
"results": {
"working_ratio": 12.395833333333334,
"blockage_ratio": 78.55902777777777,
"failure_ratio": 9.027777777777779,
"waiting_ratio": 0.017361111111111112
}
},
{
"_class": "Dream.Machine",
"id": "M2",
"results": {
"working_ratio": 74.23611111111111,
"blockage_ratio": 0.0,
"failure_ratio": 19.791666666666668,
"waiting_ratio": 5.972222222222222
}
},
{
"_class": "Dream.Repairman",
"id": "W1",
"results": {
"working_ratio": 26.73611111111111,
"waiting_ratio": 73.26388888888889
}
}
],
"_class": "Dream.Simulation",
"general": {
"_class": "Dream.Configuration"
}
}
\ No newline at end of file
dream/test/dump/Topology04.result
0 → 100644
View file @
32dd661b
{
"elementList": [
{
"_class": "Dream.Exit",
"id": "E1",
"results": {
"throughput": 732,
"takt_time": 1.966188524590164,
"lifespan": 4.30327868852459
}
},
{
"_class": "Dream.Machine",
"id": "M1",
"results": {
"working_ratio": 12.708333333333334,
"blockage_ratio": 0.0,
"failure_ratio": 9.027777777777779,
"waiting_ratio": 78.26388888888889
}
},
{
"_class": "Dream.Machine",
"id": "M2",
"results": {
"working_ratio": 76.31944444444444,
"blockage_ratio": 3.888888888888889,
"failure_ratio": 19.791666666666668,
"waiting_ratio": 0.0
}
},
{
"_class": "Dream.Repairman",
"id": "W1",
"results": {
"working_ratio": 26.73611111111111,
"waiting_ratio": 73.26388888888889
}
}
],
"_class": "Dream.Simulation",
"general": {
"_class": "Dream.Configuration"
}
}
\ No newline at end of file
dream/test/dump/Topology05.result
0 → 100644
View file @
32dd661b
{
"elementList": [
{
"_class": "Dream.Assembly",
"id": "A1",
"results": {
"working_ratio": 83.05555555555556,
"blockage_ratio": 16.84027777777778,
"waiting_ratio": 0.10416666666666667
}
},
{
"_class": "Dream.Exit",
"id": "E1",
"results": {
"throughput": 597,
"takt_time": 2.411641541038526,
"lifespan": 126.23994974874371
}
},
{
"_class": "Dream.Machine",
"id": "M1",
"results": {
"working_ratio": 10.364583333333334,
"blockage_ratio": 17.77777777777778,
"failure_ratio": 7.638888888888889,
"waiting_ratio": 64.21875
}
},
{
"_class": "Dream.Machine",
"id": "M2",
"results": {
"working_ratio": 62.1875,
"blockage_ratio": 0.0,
"failure_ratio": 19.444444444444443,
"waiting_ratio": 18.368055555555557
}
}
],
"_class": "Dream.Simulation",
"general": {
"_class": "Dream.Configuration"
}
}
\ No newline at end of file
dream/test/dump/Topology06.result
0 → 100644
View file @
32dd661b
{
"elementList": [
{
"_class": "Dream.Exit",
"id": "E1",
"results": {
"throughput": 390,
"takt_time": 3.68974358974359,
"lifespan": 17.357692307692307
}
},
{
"_class": "Dream.Machine",
"id": "M1",
"results": {
"working_ratio": 6.840277777777778,
"blockage_ratio": 84.09722222222223,
"failure_ratio": 9.027777777777779,
"waiting_ratio": 0.034722222222222224
}
},
{
"_class": "Dream.Machine",
"id": "M2",
"results": {
"working_ratio": 40.798611111111114,
"blockage_ratio": 37.34375,
"failure_ratio": 19.791666666666668,
"waiting_ratio": 2.0659722222222223
}
},
{
"_class": "Dream.Machine",
"id": "M3",
"results": {
"working_ratio": 81.31944444444444,
"blockage_ratio": 0.0,
"failure_ratio": 0.0,
"waiting_ratio": 18.680555555555557
}
},
{
"_class": "Dream.Repairman",
"id": "W1",
"results": {
"working_ratio": 26.73611111111111,
"waiting_ratio": 73.26388888888889
}
}
],
"_class": "Dream.Simulation",
"general": {
"_class": "Dream.Configuration"
}
}
\ No newline at end of file
dream/test/dump/Topology07.result
0 → 100644
View file @
32dd661b
{
"elementList": [
{
"_class": "Dream.Exit",
"id": "E1",
"results": {
"throughput": 1413,
"takt_time": 1.019108280254777,
"lifespan": 483.49062278839347
}
},
{
"_class": "Dream.Machine",
"id": "M1",
"results": {
"working_ratio": 17.36111111111111,
"blockage_ratio": 74.94791666666667,
"failure_ratio": 7.638888888888889,
"waiting_ratio": 0.052083333333333336
}
},
{
"_class": "Dream.Machine",
"id": "M2",
"results": {
"working_ratio": 43.298611111111114,
"blockage_ratio": 37.25694444444444,
"failure_ratio": 19.444444444444443,
"waiting_ratio": 0.0
}
},
{
"_class": "Dream.Machine",
"id": "M3",
"results": {
"working_ratio": 98.125,
"blockage_ratio": 0.0,
"failure_ratio": 0.0,
"waiting_ratio": 1.875
}
}
],
"_class": "Dream.Simulation",
"general": {
"_class": "Dream.Configuration"
}
}
\ No newline at end of file
dream/test/dump/Topology08.result
0 → 100644
View file @
32dd661b
{
"elementList": [
{
"_class": "Dream.Exit",
"id": "E1",
"results": {
"throughput": 1151,
"takt_time": 1.2502172024326672,
"lifespan": 497.4706776715899
}
},
{
"_class": "Dream.Machine",
"id": "M1",
"results": {
"working_ratio": 6.71875,
"blockage_ratio": 93.24652777777777,
"failure_ratio": 0.0,
"waiting_ratio": 0.034722222222222224
}
},
{
"_class": "Dream.Machine",
"id": "M2",
"results": {
"working_ratio": 40.0,
"blockage_ratio": 60.0,
"failure_ratio": 0.0,
"waiting_ratio": 0.0
}
},
{
"_class": "Dream.Machine",
"id": "M3",
"results": {
"working_ratio": 26.73611111111111,
"blockage_ratio": 73.22916666666667,
"failure_ratio": 0.0,
"waiting_ratio": 0.034722222222222224
}
},
{
"_class": "Dream.Machine",
"id": "M4",
"results": {
"working_ratio": 99.98263888888889,
"blockage_ratio": 0.0,
"failure_ratio": 0.0,
"waiting_ratio": 0.017361111111111112
}
}
],
"_class": "Dream.Simulation",
"general": {
"_class": "Dream.Configuration"
}
}
\ No newline at end of file
dream/test/dump/Topology09.result
0 → 100644
View file @
32dd661b
{
"elementList": [
{
"_class": "Dream.Exit",
"id": "E1",
"results": {
"throughput": 2880,
"takt_time": 0.49991319444444443,
"lifespan": 0.25
}
},
{
"_class": "Dream.Machine",
"id": "M1",
"results": {
"working_ratio": 50.0,
"blockage_ratio": 0.0,
"failure_ratio": 0.0,
"waiting_ratio": 50.0
}
}
],
"_class": "Dream.Simulation",
"general": {
"_class": "Dream.Configuration"
}
}
\ No newline at end of file
dream/test/dump/Topology10.result
0 → 100644
View file @
32dd661b
{
"elementList": [
{
"_class": "Dream.Exit",
"id": "E1",
"results": {
"throughput": 2590,
"takt_time": 0.5557915057915058,
"lifespan": 283.09247104247106
}
},
{
"_class": "Dream.Machine",
"id": "M1",
"results": {
"working_ratio": 32.53472222222222,
"blockage_ratio": 67.39583333333333,
"failure_ratio": 0.0,
"waiting_ratio": 0.06944444444444445
}
},
{
"_class": "Dream.Machine",
"id": "M2",
"results": {
"working_ratio": 75.05208333333333,
"blockage_ratio": 24.947916666666668,
"failure_ratio": 0.0,
"waiting_ratio": 0.0
}
},
{
"_class": "Dream.Machine",
"id": "M3",
"results": {
"working_ratio": 99.98263888888889,
"blockage_ratio": 0.0,
"failure_ratio": 0.0,
"waiting_ratio": 0.017361111111111112
}
},
{
"_class": "Dream.Machine",
"id": "M4",
"results": {
"working_ratio": 99.94791666666667,
"blockage_ratio": 0.0,
"failure_ratio": 0.0,
"waiting_ratio": 0.052083333333333336
}
}
],
"_class": "Dream.Simulation",
"general": {
"_class": "Dream.Configuration"
}
}
\ No newline at end of file
dream/test/dump/Topology11.result
0 → 100644
View file @
32dd661b
{
"elementList": [
{
"_class": "Dream.Exit",
"id": "E1",
"results": {
"throughput": 719,
"takt_time": 2.002086230876217,
"lifespan": 9.975660639777468
}
},
{
"_class": "Dream.Machine",
"id": "M1",
"results": {
"working_ratio": 37.53472222222222,
"blockage_ratio": 62.43055555555556,
"failure_ratio": 0.0,
"waiting_ratio": 0.034722222222222224
}
},
{
"_class": "Dream.Machine",
"id": "M2",
"results": {
"working_ratio": 37.604166666666664,
"blockage_ratio": 62.395833333333336,
"failure_ratio": 0.0,
"waiting_ratio": 0.0
}
},
{
"_class": "Dream.Machine",
"id": "M3",
"results": {
"working_ratio": 99.89583333333333,
"blockage_ratio": 0.0,
"failure_ratio": 0.0,
"waiting_ratio": 0.10416666666666667
}
},
{
"_class": "Dream.Repairman",
"id": "W1",
"results": {
"working_ratio": 0.0,
"waiting_ratio": 100.0
}
}
],
"_class": "Dream.Simulation",
"general": {
"_class": "Dream.Configuration"
}
}
\ No newline at end of file
dream/test/dump/Topology12.result
0 → 100644
View file @
32dd661b
{
"elementList": [
{
"_class": "Dream.Exit",
"id": "E1",
"results": {
"throughput": 1438,
"takt_time": 1.0013908205841446,
"lifespan": 5.993741307371349
}
},
{
"_class": "Dream.Machine",
"id": "M1",
"results": {
"working_ratio": 75.0,
"blockage_ratio": 24.96527777777778,
"failure_ratio": 0.0,
"waiting_ratio": 0.034722222222222224
}
},
{
"_class": "Dream.Machine",
"id": "M2",
"results": {
"working_ratio": 75.03472222222223,
"blockage_ratio": 24.96527777777778,
"failure_ratio": 0.0,
"waiting_ratio": 0.0
}
},
{
"_class": "Dream.Machine",
"id": "M3",
"results": {
"working_ratio": 99.89583333333333,
"blockage_ratio": 0.0,
"failure_ratio": 0.0,
"waiting_ratio": 0.10416666666666667
}
},
{
"_class": "Dream.Machine",
"id": "M4",
"results": {
"working_ratio": 99.86111111111111,
"blockage_ratio": 0.0,
"failure_ratio": 0.0,
"waiting_ratio": 0.1388888888888889
}
},
{
"_class": "Dream.Repairman",
"id": "W1",
"results": {
"working_ratio": 0.0,
"waiting_ratio": 100.0
}
}
],
"_class": "Dream.Simulation",
"general": {
"_class": "Dream.Configuration"
}
}
\ No newline at end of file
dream/test/dump/Topology13.result
0 → 100644
View file @
32dd661b
{
"elementList": [
{
"_class": "Dream.Assembly",
"id": "A1",
"results": {
"working_ratio": 92.36111111111111,
"blockage_ratio": 7.534722222222222,
"waiting_ratio": 0.10416666666666667
}
},
{
"_class": "Dream.Dismantle",
"id": "D1",
"results": {
"working_ratio": 46.111111111111114,
"blockage_ratio": 0.0,
"waiting_ratio": 53.888888888888886
}
},
{
"_class": "Dream.Exit",
"id": "E1",
"results": {
"throughput": 664,
"takt_time": 2.1675451807228914,
"lifespan": 56.327560240963855
}
},
{
"_class": "Dream.Exit",
"id": "E2",
"results": {
"throughput": 2656,
"takt_time": 0.5418862951807228,
"lifespan": 55.577560240963855
}
},
{
"_class": "Dream.Machine",
"id": "M1",
"results": {
"working_ratio": 11.527777777777779,
"blockage_ratio": 0.0,
"failure_ratio": 7.638888888888889,
"waiting_ratio": 80.83333333333333
}
}
],
"_class": "Dream.Simulation",
"general": {
"_class": "Dream.Configuration"
}
}
\ No newline at end of file
dream/test/dump/Topology14.result
0 → 100644
View file @
32dd661b
{
"elementList": [
{
"_class": "Dream.Assembly",
"id": "A1",
"results": {
"working_ratio": 92.36111111111111,
"blockage_ratio": 7.534722222222222,
"waiting_ratio": 0.10416666666666667
}
},
{
"_class": "Dream.Dismantle",
"id": "D1",
"results": {
"working_ratio": 46.111111111111114,
"blockage_ratio": 27.666666666670316,
"waiting_ratio": 26.222222222218573
}
},
{
"_class": "Dream.Exit",
"id": "E1",
"results": {
"throughput": 663,
"takt_time": 2.1702111613876323,
"lifespan": 57.8417043740569
}
},
{
"_class": "Dream.Exit",
"id": "E2",
"results": {
"throughput": 2655,
"takt_time": 0.542316384180791,
"lifespan": 56.056290018832385
}
},
{
"_class": "Dream.Machine",
"id": "M1",
"results": {
"working_ratio": 11.527777777777779,
"blockage_ratio": 0.0,
"failure_ratio": 7.638888888888889,
"waiting_ratio": 80.83333333333333
}
},
{
"_class": "Dream.Machine",
"id": "M2",
"results": {
"working_ratio": 46.05208333333332,
"blockage_ratio": 0.0,
"failure_ratio": 0.0,
"waiting_ratio": 53.94791666666668
}
},
{
"_class": "Dream.Machine",
"id": "M3",
"results": {
"working_ratio": 36.88541666666553,
"blockage_ratio": 4.859743009245755e-12,
"failure_ratio": 0.0,
"waiting_ratio": 63.114583333329605
}
}
],
"_class": "Dream.Simulation",
"general": {
"_class": "Dream.Configuration"
}
}
\ No newline at end of file
dream/test/dump/Topology15.result
0 → 100644
View file @
32dd661b
{
"elementList": [
{
"_class": "Dream.Conveyer",
"id": "C1",
"results": {
"working_ratio": 1.055555555555577,
"blockage_ratio": 92.05671296296349,
"waiting_ratio": 6.887731481480949
}
},
{
"_class": "Dream.Exit",
"id": "E1",
"results": {
"throughput": 769,
"takt_time": 1.8711096662332032,
"lifespan": 22.015843086259363
}
},
{
"_class": "Dream.Machine",
"id": "M1",
"results": {
"working_ratio": 13.541666666666666,
"blockage_ratio": 77.1875,
"failure_ratio": 9.027777777777779,
"waiting_ratio": 0.24305555555555555
}
},
{
"_class": "Dream.Machine",
"id": "M2",
"results": {
"working_ratio": 80.18171296296298,
"blockage_ratio": 0.0,
"failure_ratio": 19.791666666666668,
"waiting_ratio": 0.026620370370369843
}
},
{
"_class": "Dream.Repairman",
"id": "W1",
"results": {
"working_ratio": 26.73611111111111,
"waiting_ratio": 73.26388888888889
}
}
],
"_class": "Dream.Simulation",
"general": {
"_class": "Dream.Configuration"
}
}
\ No newline at end of file
dream/test/dump/Topology16.result
0 → 100644
View file @
32dd661b
{
"elementList": [
{
"_class": "Dream.Conveyer",
"id": "C1",
"results": {
"working_ratio": 0.535879629629628,
"blockage_ratio": 92.86226851851879,
"waiting_ratio": 6.601851851851579
}
},
{
"_class": "Dream.Exit",
"id": "E1",
"results": {
"throughput": 393,
"takt_time": 3.659033078880407,
"lifespan": 45.873664122137555
}
},
{
"_class": "Dream.Machine",
"id": "M1",
"results": {
"working_ratio": 7.03125,
"blockage_ratio": 83.73263888888889,
"failure_ratio": 9.027777777777779,
"waiting_ratio": 0.20833333333333334
}
},
{
"_class": "Dream.Machine",
"id": "M2",
"results": {
"working_ratio": 41.145833333333336,
"blockage_ratio": 39.035879629629626,
"failure_ratio": 19.791666666666668,
"waiting_ratio": 0.026620370370369843
}
},
{
"_class": "Dream.Machine",
"id": "M3",
"results": {
"working_ratio": 82.01388888888889,
"blockage_ratio": 0.0,
"failure_ratio": 0.0,
"waiting_ratio": 17.98611111111111
}
},
{
"_class": "Dream.Repairman",
"id": "W1",
"results": {
"working_ratio": 26.73611111111111,
"waiting_ratio": 73.26388888888889
}
}
],
"_class": "Dream.Simulation",
"general": {
"_class": "Dream.Configuration"
}
}
\ No newline at end of file
dream/test/dump/Topology17.result
0 → 100644
View file @
32dd661b
{
"elementList": [
{
"_class": "Dream.Exit",
"id": "E1",
"results": {
"throughput": 742,
"takt_time": 1.9393530997304582,
"lifespan": 7.5488544474393535
}
},
{
"_class": "Dream.Machine",
"id": "M1",
"results": {
"working_ratio": 12.934027777777779,
"blockage_ratio": 79.39236111111111,
"failure_ratio": 7.638888888888889,
"waiting_ratio": 0.034722222222222224
}
},
{
"_class": "Dream.Machine",
"id": "M2",
"results": {
"working_ratio": 77.36111111111111,
"blockage_ratio": 0.0,
"failure_ratio": 19.444444444444443,
"waiting_ratio": 3.1944444444444446
}
}
],
"_class": "Dream.Simulation",
"general": {
"_class": "Dream.Configuration"
}
}
\ No newline at end of file
dream/test/testSimulationTopology.py
0 → 100644
View file @
32dd661b
from
dream.simulation
import
LineGenerationJSON
import
json
import
os
import
tempfile
from
unittest
import
TestCase
class
SimulationTopology
(
TestCase
):
"""
Test topology files. The simulation is launched with files Topology01.json,
Topology02.json, etc, and every time we look if the result is like we expect.
If the result format or content change, it is required to dump again all
result files. But this is easy to do :
dump=1 python setup.py test
This will regenerate all dump files in dream/test/dump/.
Then you can check carefully if all outputs are correct. You could use git
diff to check what is different. Once you are sure that your new dumps are
correct, you could commit, your new dumps will be used as new reference.
"""
def
setUp
(
self
):
self
.
project_path
=
os
.
path
.
split
(
os
.
path
.
split
(
os
.
path
.
split
(
__file__
)[
0
])[
0
])[
0
]
self
.
dump_folder_path
=
os
.
path
.
join
(
self
.
project_path
,
"dream"
,
"test"
,
"dump"
)
def
checkTopology
(
self
,
filename
=
None
):
file_path
=
os
.
path
.
join
(
self
.
project_path
,
"dream"
,
"simulation"
,
"JSONInputs"
,
"%s.json"
%
filename
)
input_file
=
open
(
file_path
,
"r"
)
input_data
=
input_file
.
read
()
input_file
.
close
()
result
=
LineGenerationJSON
.
main
(
input_data
=
input_data
)
result_data
=
json
.
loads
(
result
)
# Slightly change the output to make it stable
del
result_data
[
"general"
][
"totalExecutionTime"
]
result_data
[
"elementList"
].
sort
(
key
=
lambda
x
:
x
[
"id"
])
stable_result
=
json
.
dumps
(
result_data
,
indent
=
True
)
dump_path
=
os
.
path
.
join
(
self
.
dump_folder_path
,
"%s.result"
%
filename
)
if
bool
(
os
.
environ
.
get
(
"dump"
,
False
)):
dump_file
=
open
(
dump_path
,
'w'
)
dump_file
.
write
(
stable_result
)
dump_file
.
close
()
dump_file
=
open
(
dump_path
,
"r"
)
dump_result
=
dump_file
.
read
()
dump_file
.
close
()
self
.
assertEquals
(
stable_result
,
dump_result
,
"outputs are different"
)
# Automatically create a test method for every topology
for
x
in
range
(
1
,
18
):
def
getTestTopology
():
filename
=
"Topology%02i"
%
x
def
test_topology
(
self
):
self
.
checkTopology
(
filename
=
filename
)
return
test_topology
setattr
(
SimulationTopology
,
"test_topology_%02i"
%
x
,
getTestTopology
())
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment