Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 0 additions & 90 deletions .github/workflows/dockerfile_ci.yml

This file was deleted.

41 changes: 0 additions & 41 deletions Dockerfile

This file was deleted.

13 changes: 13 additions & 0 deletions code/logic/fossil/pizza/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@
# define FOSSIL_PIZZA_API
#endif

/*
* Objective-C / Objective-C++ includes guarded for Apple platforms
*/

#if defined(__APPLE__)
#include <TargetConditionals.h>

// macOS, iOS, tvOS, watchOS
#if TARGET_OS_OSX || TARGET_OS_IPHONE || TARGET_OS_TV || TARGET_OS_WATCH
#include <Foundation/Foundation.h>
#endif
#endif // __APPLE__

// C headers
#include <inttypes.h>
#include <stdbool.h>
Expand Down
5 changes: 4 additions & 1 deletion code/logic/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ fossil_test_lib = library('fossil_test',
test_code,
install: true,
include_directories: dir,
dependencies: [cc.find_library('m', required: false)
dependencies: [
cc.find_library('m', required: false),
apple_dep
]
)

fossil_test_dep = declare_dependency(
link_with: fossil_test_lib,
dependencies: [apple_dep],
include_directories: dir
)

Expand Down
4 changes: 4 additions & 0 deletions code/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
if host_machine.system() == 'darwin'
add_languages('objc', native: false, required: true)
add_languages('objcpp', native: false, required: true)

apple_dep = dependency('appleframeworks', modules : ['Foundation'])
else
apple_dep = []
endif

subdir('logic')
Expand Down
76 changes: 38 additions & 38 deletions code/tests/cases/test_sample.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,90 +13,90 @@
* -----------------------------------------------------------------------------
*/

#import <Foundation/Foundation.h>
#include "fossil/pizza/framework.h"

// Test data structure for a sample test
FOSSIL_MOCK_STRUCT(ObjCSampleTestData) {
int input;
int expected_output;
} ObjCSampleTestData;
// -----------------------------------------------------------------------------
// Objective-C Sample Test Data Class
// -----------------------------------------------------------------------------
@interface ObjCSampleTestData : NSObject
@property(nonatomic, assign) int input;
@property(nonatomic, assign) int expected_output;
- (instancetype)initWithInput:(int)input expected:(int)expected;
@end

// Setup function for the test suite
@implementation ObjCSampleTestData
- (instancetype)initWithInput:(int)input expected:(int)expected {
self = [super init];
if (self) {
_input = input;
_expected_output = expected;
}
return self;
}
@end

// -----------------------------------------------------------------------------
// Fossil Logic Test Suite Setup/Teardown
// -----------------------------------------------------------------------------
FOSSIL_SETUP(objc_sample_suite) {
// Setup code here
// Setup code for Objective-C tests
}

// Teardown function for the test suite
FOSSIL_TEARDOWN(objc_sample_suite) {
// Teardown code here
// Teardown code for Objective-C tests
}

// Define the test suite and add test cases
FOSSIL_SUITE(objc_sample_suite);

// A simple test case to check if input + 1 equals expected_output
// -----------------------------------------------------------------------------
// Fossil Logic Test Cases (Objective-C flavored)
// -----------------------------------------------------------------------------
FOSSIL_TEST(objc_test_input_increment) {
ObjCSampleTestData data = {5, 6}; // Simplified initialization

ObjCSampleTestData *data = [[ObjCSampleTestData alloc] initWithInput:5 expected:6];
int actual_output = data.input + 1;

FOSSIL_TEST_ASSUME(actual_output == data.expected_output, "Increment test failed");
}

// A simple test case to check if input - 1 equals expected_output
FOSSIL_TEST(objc_test_input_decrement) {
ObjCSampleTestData data = {5, 4}; // Simplified initialization

ObjCSampleTestData *data = [[ObjCSampleTestData alloc] initWithInput:5 expected:4];
int actual_output = data.input - 1;

FOSSIL_TEST_ASSUME(actual_output == data.expected_output, "Decrement test failed");
}

// A simple test case to check if input * 2 equals expected_output
FOSSIL_TEST(objc_test_input_double) {
ObjCSampleTestData data = {5, 10}; // Simplified initialization

ObjCSampleTestData *data = [[ObjCSampleTestData alloc] initWithInput:5 expected:10];
int actual_output = data.input * 2;

FOSSIL_TEST_ASSUME(actual_output == data.expected_output, "Double test failed");
}

// A simple test case to check if input / 2 equals expected_output
FOSSIL_TEST(objc_test_input_half) {
ObjCSampleTestData data = {10, 5}; // Simplified initialization

ObjCSampleTestData *data = [[ObjCSampleTestData alloc] initWithInput:10 expected:5];
int actual_output = data.input / 2;

FOSSIL_TEST_ASSUME(actual_output == data.expected_output, "Half test failed");
}

// A simple test case to check if input % 2 equals expected_output
FOSSIL_TEST(objc_test_input_modulo) {
ObjCSampleTestData data = { 5, 1 };

ObjCSampleTestData *data = [[ObjCSampleTestData alloc] initWithInput:5 expected:1];
int actual_output = data.input % 2;

FOSSIL_TEST_ASSUME(actual_output == data.expected_output, "Modulo test failed");
}

// A simple test case to check if input squared equals expected_output
FOSSIL_TEST(objc_test_input_square) {
ObjCSampleTestData data = { 3, 9 };

ObjCSampleTestData *data = [[ObjCSampleTestData alloc] initWithInput:3 expected:9];
int actual_output = data.input * data.input;

FOSSIL_TEST_ASSUME(actual_output == data.expected_output, "Square test failed");
}

// A simple test case to check if input is equal to expected_output
FOSSIL_TEST(objc_test_input_equal) {
ObjCSampleTestData data = { 7, 7 };

ObjCSampleTestData *data = [[ObjCSampleTestData alloc] initWithInput:7 expected:7];
int actual_output = data.input;

FOSSIL_TEST_ASSUME(actual_output == data.expected_output, "Equality test failed");
}

// -----------------------------------------------------------------------------
// Grouping Tests
// -----------------------------------------------------------------------------
FOSSIL_TEST_GROUP(objc_sample_test_cases) {
FOSSIL_TEST_ADD(objc_sample_suite, objc_test_input_increment);
FOSSIL_TEST_ADD(objc_sample_suite, objc_test_input_decrement);
Expand Down
Loading
Loading