TestApplicationAndStarterIdentities.cpp 973 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "Test.h"
#include "../include/Strings.h"
#include <iostream>

using namespace std;
using namespace cameo;

int main(int argc, char *argv[]) {

	ApplicationAndStarterIdentities identities = ApplicationAndStarterIdentities::parse("my-app.31@tcp://gamma75:9999:your-app.15@tcp://gamma63:789");

	CAMEO_ASSERT_TRUE("my-app.31@tcp://gamma75:9999" == identities.getApplication().toString());
	CAMEO_ASSERT_TRUE(identities.getStarter().has_value());
	CAMEO_ASSERT_TRUE("your-app.15@tcp://gamma63:789" == identities.getStarter().value().toString());

	identities = ApplicationAndStarterIdentities::parse("my-app.31@tcp://gamma75:9999:");

	CAMEO_ASSERT_TRUE("my-app.31@tcp://gamma75:9999" == identities.getApplication().toString());
	CAMEO_ASSERT_TRUE(!identities.getStarter().has_value());

	bool error = false;
	try {
		ApplicationAndStarterIdentities::parse("my-app.31@tcp://gamma75:9999");
	}
	catch (...) {
		error = true;
	}
	CAMEO_ASSERT_TRUE(error);

	return 0;
}