Welcome to mirror list, hosted at ThFree Co, Russian Federation.

fn_guid_tests.cpp « tests « script « src - github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d98cfd6ff880ba99c4463a49aa355a4e7d33dafd (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
 * \file   fn_guid_tests.cpp
 * \brief  Automated tests for the guid() function.
 * \author Copyright (c) 2007-2008 Jason Perkins and the Premake project
 */

#include "premake.h"
#include "script_tests.h"
extern "C" {
#include "base/guid.h"
}


SUITE(script)
{
	TEST_FIXTURE(FxAccessor, Guid_Exists_OnStartup)
	{
		const char* result = script_run_string(script, 
			"return (guid ~= nil)");
		CHECK_EQUAL("true", result);
	}

	TEST_FIXTURE(FxAccessor, Guid_Error_OnNoActiveProject)
	{
		Script script = script_create();
		const char* result = script_run_string(script, "guid()");
		CHECK_EQUAL("no active project", result);
		script_destroy(script);
	}

	TEST_FIXTURE(FxAccessor, Guid_CanRoundtrip)
	{
		const char* result = script_run_string(script,
			"guid '0C202E43-B9AF-4972-822B-5A42F0BF008C';"
			"return guid()");
		CHECK_EQUAL("0C202E43-B9AF-4972-822B-5A42F0BF008C", result);
	}

	TEST_FIXTURE(FxAccessor, Guid_RaisesError_OnInvalidGuid)
	{
		const char* result = script_run_string(script,
			"guid '0C202E43-XXXX-4972-822B-5A42F0BF008C'");
		CHECK_EQUAL("invalid value '0C202E43-XXXX-4972-822B-5A42F0BF008C'", result);
	}
}