Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
net_sup_dem_test.cc File Reference

Comprehensive tests for Net_Sup_Dem_Graph class. More...

#include <gtest/gtest.h>
#include <tpl_net_sup_dem.H>
#include <tpl_maxflow.H>
#include <tpl_dynDlist.H>
#include <limits>
#include <random>
#include <string>
Include dependency graph for net_sup_dem_test.cc:

Go to the source code of this file.

Classes

class  NetSupDemNodeTest
 
class  NetSupDemGraphTest
 
class  AuxNetTest
 
class  FeasibilityTest
 
class  StringNetTest
 

Typedefs

using SimpleNode = Net_Sup_Dem_Node< Empty_Class, int >
 
using SimpleArc = Net_Arc< Empty_Class, int >
 
using SimpleNet = Net_Sup_Dem_Graph< SimpleNode, SimpleArc >
 
using StringNode = Net_Sup_Dem_Node< std::string, double >
 
using StringArc = Net_Arc< std::string, double >
 
using StringNet = Net_Sup_Dem_Graph< StringNode, StringArc >
 

Functions

 TEST_F (NetSupDemNodeTest, DefaultConstructor)
 
 TEST_F (NetSupDemNodeTest, InfoConstructor)
 
 TEST_F (NetSupDemNodeTest, CopyFromPointer)
 
 TEST_F (NetSupDemNodeTest, GetSupplyFlowModifiable)
 
 TEST_F (NetSupDemGraphTest, DefaultConstructor)
 
 TEST_F (NetSupDemGraphTest, InsertNodeWithSupply)
 
 TEST_F (NetSupDemGraphTest, InsertNodeWithDemand)
 
 TEST_F (NetSupDemGraphTest, InsertTransitNode)
 
 TEST_F (NetSupDemGraphTest, CountSupplyNodes)
 
 TEST_F (NetSupDemGraphTest, CountDemandNodes)
 
 TEST_F (NetSupDemGraphTest, TotalSupply)
 
 TEST_F (NetSupDemGraphTest, TotalDemand)
 
 TEST_F (NetSupDemGraphTest, IsBalanced)
 
 TEST_F (NetSupDemGraphTest, IsNotBalanced)
 
 TEST_F (NetSupDemGraphTest, SetSupplyFlow)
 
 TEST_F (NetSupDemGraphTest, SetDemandFlow)
 
 TEST_F (NetSupDemGraphTest, SetSupplyFlowExceedsCapacityThrows)
 
 TEST_F (NetSupDemGraphTest, SetDemandFlowExceedsCapacityThrows)
 
 TEST_F (AuxNetTest, ComputeAuxNet)
 
 TEST_F (AuxNetTest, ComputeAuxNetTwiceThrows)
 
 TEST_F (AuxNetTest, GetAuxNetBeforeCompute)
 
 TEST_F (AuxNetTest, GetAuxNetAfterCompute)
 
 TEST_F (AuxNetTest, FreeAuxNet)
 
 TEST_F (AuxNetTest, FreeAuxNetWithoutComputeThrows)
 
 TEST_F (AuxNetTest, IsFeasibleWithoutAuxNetThrows)
 
 TEST_F (FeasibilityTest, EmptyNetworkIsFeasible)
 
 TEST_F (FeasibilityTest, SupplyOnlyNetworkIsNotFeasible)
 
 TEST_F (FeasibilityTest, SupplyNotMeetingFlowRequirement)
 
 TEST_F (FeasibilityTest, DemandOnlyNetworkIsNotFeasible)
 
 TEST_F (FeasibilityTest, DemandNotMet)
 
 TEST_F (FeasibilityTest, MixedSupplyDemandFeasible)
 
 TEST_F (FeasibilityTest, MixedSupplyDemandNotFeasible)
 
 TEST_F (FeasibilityTest, NonFeasibleSupplyNodes)
 
 TEST_F (FeasibilityTest, NonFeasibleDemandNodes)
 
 TEST_F (FeasibilityTest, MultipleMixedNonFeasibleNodes)
 
 TEST_F (NetSupDemGraphTest, SupplyExceedsOutCapacityThrows)
 
 TEST_F (NetSupDemGraphTest, DemandExceedsInCapacityThrows)
 
 TEST_F (NetSupDemGraphTest, OnlySupplyNodes)
 
 TEST_F (NetSupDemGraphTest, OnlyDemandNodes)
 
 TEST_F (NetSupDemGraphTest, OnlyTransitNodes)
 
 TEST_F (NetSupDemGraphTest, ZeroSupplyValue)
 
 TEST_F (StringNetTest, InsertNodeWithStringInfo)
 
 TEST_F (StringNetTest, DoubleFlowValues)
 
 TEST (NetSupDemDestructorTest, DestructorFreesAuxNet)
 
 TEST (IntegrationTest, CompleteWorkflow)
 
 TEST (FloatingFeasibilityTest, AFlowOfTenthsIsFeasible)
 
 TEST (FloatingFeasibilityTest, TheDemandsOfASupplyInTenthsAreMet)
 
 TEST (FloatingFeasibilityTest, ARealDeficitIsNotMet)
 
 TEST (FloatingFeasibilityTest, FeasibleInstancesInTenthsAreFeasible)
 
 TEST (FloatingFeasibilityTest, AnInfiniteSupplyIsMetOnlyByAnInfiniteFlow)
 
 TEST (NetSupDemChangedNetwork, AnExchangeThroughTheBaseTakesTheSuperNodesAway)
 
 TEST (NetSupDemChangedNetwork, ARemovedSuperNodeIsForgotten)
 
 TEST (NetSupDemChangedNetwork, AnotherNodeRemovedIsNoneOfThem)
 
 TEST (NetSupDemChangedNetwork, ClearGraphAndCopyGraphTakeTheSuperNodesAway)
 
 TEST (NetSupDemChangedNetwork, AChangeThatLeavesTheSuperNodesKeepsThem)
 
 TEST (NetSupDemChangedNetwork, ItsOwnSwapMovesAndCopiesTakeTheSuperNodesAlong)
 
 TEST (NetSupDemChangedNetwork, WithoutASuperNodeNoSupplyNorDemandIsMet)
 
int main (int argc, char **argv)
 

Detailed Description

Comprehensive tests for Net_Sup_Dem_Graph class.

Definition in file net_sup_dem_test.cc.

Typedef Documentation

◆ SimpleArc

using SimpleArc = Net_Arc<Empty_Class, int>

Definition at line 54 of file net_sup_dem_test.cc.

◆ SimpleNet

using SimpleNet = Net_Sup_Dem_Graph<SimpleNode, SimpleArc>

Definition at line 55 of file net_sup_dem_test.cc.

◆ SimpleNode

Definition at line 53 of file net_sup_dem_test.cc.

◆ StringArc

using StringArc = Net_Arc<std::string, double>

Definition at line 59 of file net_sup_dem_test.cc.

◆ StringNet

Definition at line 60 of file net_sup_dem_test.cc.

◆ StringNode

using StringNode = Net_Sup_Dem_Node<std::string, double>

Definition at line 58 of file net_sup_dem_test.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 1401 of file net_sup_dem_test.cc.

◆ TEST() [1/14]

◆ TEST() [2/14]

TEST ( FloatingFeasibilityTest  ,
AnInfiniteSupplyIsMetOnlyByAnInfiniteFlow   
)

◆ TEST() [3/14]

TEST ( FloatingFeasibilityTest  ,
ARealDeficitIsNotMet   
)

◆ TEST() [4/14]

TEST ( FloatingFeasibilityTest  ,
FeasibleInstancesInTenthsAreFeasible   
)

◆ TEST() [5/14]

TEST ( FloatingFeasibilityTest  ,
TheDemandsOfASupplyInTenthsAreMet   
)

Definition at line 733 of file net_sup_dem_test.cc.

References Aleph::Dlink::is_empty().

◆ TEST() [6/14]

TEST ( IntegrationTest  ,
CompleteWorkflow   
)

◆ TEST() [7/14]

TEST ( NetSupDemChangedNetwork  ,
AChangeThatLeavesTheSuperNodesKeepsThem   
)

Definition at line 1177 of file net_sup_dem_test.cc.

References Aleph::DynDlist< T >::append(), and arcs.

◆ TEST() [8/14]

TEST ( NetSupDemChangedNetwork  ,
AnExchangeThroughTheBaseTakesTheSuperNodesAway   
)

Definition at line 1047 of file net_sup_dem_test.cc.

◆ TEST() [9/14]

TEST ( NetSupDemChangedNetwork  ,
AnotherNodeRemovedIsNoneOfThem   
)

Definition at line 1134 of file net_sup_dem_test.cc.

◆ TEST() [10/14]

TEST ( NetSupDemChangedNetwork  ,
ARemovedSuperNodeIsForgotten   
)

Definition at line 1113 of file net_sup_dem_test.cc.

◆ TEST() [11/14]

TEST ( NetSupDemChangedNetwork  ,
ClearGraphAndCopyGraphTakeTheSuperNodesAway   
)

Definition at line 1154 of file net_sup_dem_test.cc.

References Aleph::clear_graph(), and Aleph::copy_graph().

◆ TEST() [12/14]

TEST ( NetSupDemChangedNetwork  ,
ItsOwnSwapMovesAndCopiesTakeTheSuperNodesAlong   
)

Definition at line 1273 of file net_sup_dem_test.cc.

References Aleph::copy().

◆ TEST() [13/14]

TEST ( NetSupDemChangedNetwork  ,
WithoutASuperNodeNoSupplyNorDemandIsMet   
)

Definition at line 1368 of file net_sup_dem_test.cc.

References Aleph::and, and Aleph::edmonds_karp_maximum_flow().

◆ TEST() [14/14]

TEST ( NetSupDemDestructorTest  ,
DestructorFreesAuxNet   
)

Definition at line 612 of file net_sup_dem_test.cc.

◆ TEST_F() [1/43]

TEST_F ( AuxNetTest  ,
ComputeAuxNet   
)

Definition at line 271 of file net_sup_dem_test.cc.

◆ TEST_F() [2/43]

TEST_F ( AuxNetTest  ,
ComputeAuxNetTwiceThrows   
)

Definition at line 283 of file net_sup_dem_test.cc.

◆ TEST_F() [3/43]

TEST_F ( AuxNetTest  ,
FreeAuxNet   
)

Definition at line 301 of file net_sup_dem_test.cc.

◆ TEST_F() [4/43]

TEST_F ( AuxNetTest  ,
FreeAuxNetWithoutComputeThrows   
)

Definition at line 313 of file net_sup_dem_test.cc.

◆ TEST_F() [5/43]

TEST_F ( AuxNetTest  ,
GetAuxNetAfterCompute   
)

Definition at line 295 of file net_sup_dem_test.cc.

◆ TEST_F() [6/43]

TEST_F ( AuxNetTest  ,
GetAuxNetBeforeCompute   
)

Definition at line 290 of file net_sup_dem_test.cc.

◆ TEST_F() [7/43]

TEST_F ( AuxNetTest  ,
IsFeasibleWithoutAuxNetThrows   
)

Definition at line 318 of file net_sup_dem_test.cc.

◆ TEST_F() [8/43]

TEST_F ( FeasibilityTest  ,
DemandNotMet   
)

Definition at line 385 of file net_sup_dem_test.cc.

References Aleph::edmonds_karp_maximum_flow().

◆ TEST_F() [9/43]

TEST_F ( FeasibilityTest  ,
DemandOnlyNetworkIsNotFeasible   
)

Definition at line 376 of file net_sup_dem_test.cc.

◆ TEST_F() [10/43]

TEST_F ( FeasibilityTest  ,
EmptyNetworkIsFeasible   
)

◆ TEST_F() [11/43]

TEST_F ( FeasibilityTest  ,
MixedSupplyDemandFeasible   
)

Definition at line 397 of file net_sup_dem_test.cc.

References Aleph::edmonds_karp_maximum_flow().

◆ TEST_F() [12/43]

TEST_F ( FeasibilityTest  ,
MixedSupplyDemandNotFeasible   
)

Definition at line 413 of file net_sup_dem_test.cc.

References Aleph::edmonds_karp_maximum_flow().

◆ TEST_F() [13/43]

TEST_F ( FeasibilityTest  ,
MultipleMixedNonFeasibleNodes   
)

◆ TEST_F() [14/43]

TEST_F ( FeasibilityTest  ,
NonFeasibleDemandNodes   
)

◆ TEST_F() [15/43]

TEST_F ( FeasibilityTest  ,
NonFeasibleSupplyNodes   
)

◆ TEST_F() [16/43]

TEST_F ( FeasibilityTest  ,
SupplyNotMeetingFlowRequirement   
)

Definition at line 363 of file net_sup_dem_test.cc.

References Aleph::edmonds_karp_maximum_flow().

◆ TEST_F() [17/43]

TEST_F ( FeasibilityTest  ,
SupplyOnlyNetworkIsNotFeasible   
)

Definition at line 354 of file net_sup_dem_test.cc.

◆ TEST_F() [18/43]

TEST_F ( NetSupDemGraphTest  ,
CountDemandNodes   
)

Definition at line 152 of file net_sup_dem_test.cc.

◆ TEST_F() [19/43]

TEST_F ( NetSupDemGraphTest  ,
CountSupplyNodes   
)

Definition at line 142 of file net_sup_dem_test.cc.

◆ TEST_F() [20/43]

TEST_F ( NetSupDemGraphTest  ,
DefaultConstructor   
)

Definition at line 111 of file net_sup_dem_test.cc.

◆ TEST_F() [21/43]

TEST_F ( NetSupDemGraphTest  ,
DemandExceedsInCapacityThrows   
)

Definition at line 513 of file net_sup_dem_test.cc.

◆ TEST_F() [22/43]

TEST_F ( NetSupDemGraphTest  ,
InsertNodeWithDemand   
)

Definition at line 125 of file net_sup_dem_test.cc.

◆ TEST_F() [23/43]

TEST_F ( NetSupDemGraphTest  ,
InsertNodeWithSupply   
)

Definition at line 118 of file net_sup_dem_test.cc.

◆ TEST_F() [24/43]

TEST_F ( NetSupDemGraphTest  ,
InsertTransitNode   
)

Definition at line 132 of file net_sup_dem_test.cc.

◆ TEST_F() [25/43]

TEST_F ( NetSupDemGraphTest  ,
IsBalanced   
)

Definition at line 180 of file net_sup_dem_test.cc.

◆ TEST_F() [26/43]

TEST_F ( NetSupDemGraphTest  ,
IsNotBalanced   
)

Definition at line 189 of file net_sup_dem_test.cc.

◆ TEST_F() [27/43]

TEST_F ( NetSupDemGraphTest  ,
OnlyDemandNodes   
)

Definition at line 541 of file net_sup_dem_test.cc.

◆ TEST_F() [28/43]

TEST_F ( NetSupDemGraphTest  ,
OnlySupplyNodes   
)

Definition at line 526 of file net_sup_dem_test.cc.

◆ TEST_F() [29/43]

TEST_F ( NetSupDemGraphTest  ,
OnlyTransitNodes   
)

Definition at line 556 of file net_sup_dem_test.cc.

◆ TEST_F() [30/43]

TEST_F ( NetSupDemGraphTest  ,
SetDemandFlow   
)

Definition at line 210 of file net_sup_dem_test.cc.

◆ TEST_F() [31/43]

TEST_F ( NetSupDemGraphTest  ,
SetDemandFlowExceedsCapacityThrows   
)

Definition at line 227 of file net_sup_dem_test.cc.

◆ TEST_F() [32/43]

TEST_F ( NetSupDemGraphTest  ,
SetSupplyFlow   
)

Definition at line 201 of file net_sup_dem_test.cc.

◆ TEST_F() [33/43]

TEST_F ( NetSupDemGraphTest  ,
SetSupplyFlowExceedsCapacityThrows   
)

Definition at line 219 of file net_sup_dem_test.cc.

◆ TEST_F() [34/43]

TEST_F ( NetSupDemGraphTest  ,
SupplyExceedsOutCapacityThrows   
)

Definition at line 504 of file net_sup_dem_test.cc.

◆ TEST_F() [35/43]

TEST_F ( NetSupDemGraphTest  ,
TotalDemand   
)

Definition at line 171 of file net_sup_dem_test.cc.

◆ TEST_F() [36/43]

TEST_F ( NetSupDemGraphTest  ,
TotalSupply   
)

Definition at line 162 of file net_sup_dem_test.cc.

◆ TEST_F() [37/43]

TEST_F ( NetSupDemGraphTest  ,
ZeroSupplyValue   
)

Definition at line 571 of file net_sup_dem_test.cc.

◆ TEST_F() [38/43]

TEST_F ( NetSupDemNodeTest  ,
CopyFromPointer   
)

Definition at line 85 of file net_sup_dem_test.cc.

References Aleph::copy().

◆ TEST_F() [39/43]

TEST_F ( NetSupDemNodeTest  ,
DefaultConstructor   
)

Definition at line 72 of file net_sup_dem_test.cc.

◆ TEST_F() [40/43]

TEST_F ( NetSupDemNodeTest  ,
GetSupplyFlowModifiable   
)

Definition at line 94 of file net_sup_dem_test.cc.

◆ TEST_F() [41/43]

TEST_F ( NetSupDemNodeTest  ,
InfoConstructor   
)

Definition at line 79 of file net_sup_dem_test.cc.

◆ TEST_F() [42/43]

TEST_F ( StringNetTest  ,
DoubleFlowValues   
)

Definition at line 596 of file net_sup_dem_test.cc.

◆ TEST_F() [43/43]

TEST_F ( StringNetTest  ,
InsertNodeWithStringInfo   
)