@@ -48,8 +48,7 @@ void UnitTestReadYaml::executeTest() {
4848
4949 WsjcppYamlNode *pServices = yaml.getRoot ()->getElement (" services" );
5050
51- compare (" has services.vote" , pServices->hasElement (" vote" ), true );
52- compare (" has services.vote is map" , pServices->getElement (" vote" )->isMap (), true );
51+
5352
5453
5554 /*
@@ -60,18 +59,37 @@ void UnitTestReadYaml::executeTest() {
6059 command: python app.py
6160 volumes:
6261 - ./vote:/app
63- ports:
64- - "5000:80"
65- networks:
66- - front-tier
67- - back-tier
68-
69- result:
70- build: ./result
71- command: nodemon server.js
72- volumes:
73- - ./result:/app
62+
7463 */
64+ // services.vote
65+ {
66+ compare (" has services.vote" , pServices->hasElement (" vote" ), true );
67+ compare (" services.vote is map" , pServices->getElement (" vote" )->isMap (), true );
68+ compare (" services.vote keys size 5" , pServices->getElement (" vote" )->getKeys ().size (), 5 );
69+
70+ WsjcppYamlNode *pVote = pServices->getElement (" vote" );
71+
72+ compare (" has services.vote.build" , pVote->hasElement (" build" ), true );
73+ compare (" services.vote.build val" , pVote->getElement (" build" )->getValue (), " ./vote" );
74+
75+ compare (" has services.vote.command" , pVote->hasElement (" command" ), true );
76+ compare (" services.vote.command val" , pVote->getElement (" command" )->getValue (), " python app.py" );
77+
78+ WsjcppYamlNode *pVolumes = pVote->getElement (" volumes" );
79+ compare (" services.vote.volumes is array" , pVolumes->isArray (), true );
80+ compare (" services.vote.volumes size 1" , pVolumes->getLength (), 1 );
81+ compare (" services.vote.volumes val 0" , pVolumes->getElement (0 )->getValue (), " ./vote:/app" );
82+
83+ WsjcppYamlNode *pVotePorts = pVote->getElement (" ports" );
84+ compare (" services.vote.ports is array" , pVotePorts->isArray (), true );
85+ compare (" services.vote.ports size 1" , pVotePorts->getLength (), 1 );
86+ compare (" services.vote.ports val 0" , pVotePorts->getElement (0 )->getValue (), " 5000:80" );
87+
88+ WsjcppYamlNode *pVoteNetworks = pVote->getElement (" networks" );
89+ compare (" services.vote.networks size 2" , pVoteNetworks->getLength (), 2 );
90+ compare (" services.vote.networks val 0" , pVoteNetworks->getElement (0 )->getValue (), " front-tier" );
91+ compare (" services.vote.networks val 1" , pVoteNetworks->getElement (1 )->getValue (), " back-tier" );
92+ }
7593
7694 // services.result
7795 {
@@ -81,6 +99,12 @@ void UnitTestReadYaml::executeTest() {
8199
82100 WsjcppYamlNode *pResult = pServices->getElement (" result" );
83101
102+ compare (" has services.result.build" , pResult->hasElement (" build" ), true );
103+ compare (" services.result.build val" , pResult->getElement (" build" )->getValue (), " ./result" );
104+
105+ compare (" has services.result.command" , pResult->hasElement (" command" ), true );
106+ compare (" services.result.command val" , pResult->getElement (" command" )->getValue (), " nodemon server.js" );
107+
84108 WsjcppYamlNode *pResultVolumes = pResult->getElement (" volumes" );
85109 compare (" services.result.volumes is array" , pResultVolumes->isArray (), true );
86110 compare (" services.result.volumes size 1" , pResultVolumes->getLength (), 1 );
0 commit comments