diff options
Diffstat (limited to 'src/project/tests/fields_tests.cpp')
-rw-r--r-- | src/project/tests/fields_tests.cpp | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/src/project/tests/fields_tests.cpp b/src/project/tests/fields_tests.cpp index ef05136..8d50ba2 100644 --- a/src/project/tests/fields_tests.cpp +++ b/src/project/tests/fields_tests.cpp @@ -1,64 +1,64 @@ -/**
- * \file fields_tests.cpp
- * \brief Automated tests for the Fields class.
- * \author Copyright (c) 2008 Jason Perkins and the Premake project
- */
-
-#include "premake.h"
-#include "testing/testing.h"
-extern "C" {
-#include "project/fields.h"
-}
-
-enum TestFields
-{
- TestStringValue,
- TestListValue
-};
-
-static FieldInfo TestFieldInfo[] =
-{
- { "stringval", StringField },
- { "listval", ListField },
- { 0, StringField }
-};
-
-
-struct FxFields
-{
- Fields fields;
-
- FxFields()
- {
- fields = fields_create(TestFieldInfo);
- }
-
- ~FxFields()
- {
- fields_destroy(fields);
- }
-};
-
-
-SUITE(fields)
-{
- TEST_FIXTURE(FxFields, GetValue_ReturnsNull_OnUnsetString)
- {
- const char* result = fields_get_value(fields, TestStringValue);
- CHECK(result == NULL);
- }
-
- TEST_FIXTURE(FxFields, SetValue_CanRoundtrip)
- {
- fields_set_value(fields, TestStringValue, "String Value");
- const char* result = fields_get_value(fields, TestStringValue);
- CHECK_EQUAL("String Value", result);
- }
-
- TEST_FIXTURE(FxFields, SetValues_CanRoundtrip)
- {
- Strings values = strings_create();
- fields_set_values(fields, TestListValue, values);
- CHECK(values == fields_get_values(fields, TestListValue));
- }
-}
+/** + * \file fields_tests.cpp + * \brief Automated tests for the Fields class. + * \author Copyright (c) 2008 Jason Perkins and the Premake project + */ + +#include "premake.h" +#include "testing/testing.h" +extern "C" { +#include "project/fields.h" +} + +enum TestFields +{ + TestStringValue, + TestListValue +}; + +static FieldInfo TestFieldInfo[] = +{ + { "stringval", StringField }, + { "listval", ListField }, + { 0, StringField } +}; + + +struct FxFields +{ + Fields fields; + + FxFields() + { + fields = fields_create(TestFieldInfo); + } + + ~FxFields() + { + fields_destroy(fields); + } +}; + + +SUITE(fields) +{ + TEST_FIXTURE(FxFields, GetValue_ReturnsNull_OnUnsetString) + { + const char* result = fields_get_value(fields, TestStringValue); + CHECK(result == NULL); + } + + TEST_FIXTURE(FxFields, SetValue_CanRoundtrip) + { + fields_set_value(fields, TestStringValue, "String Value"); + const char* result = fields_get_value(fields, TestStringValue); + CHECK_EQUAL("String Value", result); + } + + TEST_FIXTURE(FxFields, SetValues_CanRoundtrip) + { + Strings values = strings_create(); + fields_set_values(fields, TestListValue, values); + CHECK(values == fields_get_values(fields, TestListValue)); + } +} |