Skip to content

Commit

Permalink
Fix ethash C header
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Apr 13, 2018
1 parent af09afb commit 9551b59
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 2 deletions.
1 change: 1 addition & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ comment:
ignore:
- "test/benchmarks/*"
- "test/fakeminer/*"
- "test/integration/*"
8 changes: 6 additions & 2 deletions include/ethash/ethash.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@

#ifdef __cplusplus
#define NOEXCEPT noexcept
#else
#define NOEXCEPT
#endif

#ifdef __cplusplus
extern "C" {
#endif

Expand Down Expand Up @@ -41,9 +45,9 @@ int ethash_calculate_light_cache_num_items(int epoch_number) NOEXCEPT;
int ethash_calculate_full_dataset_num_items(int epoch_number) NOEXCEPT;


ethash_epoch_context* ethash_create_epoch_context(int epoch_number) NOEXCEPT;
struct ethash_epoch_context* ethash_create_epoch_context(int epoch_number) NOEXCEPT;

void ethash_destroy_epoch_context(ethash_epoch_context* context) NOEXCEPT;
void ethash_destroy_epoch_context(struct ethash_epoch_context* context) NOEXCEPT;

#ifdef __cplusplus
}
Expand Down
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@

add_subdirectory(benchmarks)
add_subdirectory(fakeminer)
add_subdirectory(integration)
add_subdirectory(unittests)
5 changes: 5 additions & 0 deletions test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ethash: C/C++ implementation of Ethash, the Ethereum Proof of Work algorithm.
# Copyright 2018 Pawel Bylica.
# Licensed under the Apache License, Version 2.0. See the LICENSE file.

add_subdirectory(compilation)
15 changes: 15 additions & 0 deletions test/integration/compilation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# ethash: C/C++ implementation of Ethash, the Ethereum Proof of Work algorithm.
# Copyright 2018 Pawel Bylica.
# Licensed under the Apache License, Version 2.0. See the LICENSE file.

add_library(test-compile-c90 STATIC compilation_test.c)
target_link_libraries(test-compile-c90 PRIVATE ethash)
set_target_properties(test-compile-c90 PROPERTIES C_STANDARD 90 C_EXTENSIONS OFF)

add_library(test-compile-c99 STATIC compilation_test.c)
target_link_libraries(test-compile-c99 PRIVATE ethash)
set_target_properties(test-compile-c99 PROPERTIES C_STANDARD 99 C_EXTENSIONS OFF)

add_library(test-compile-c11 STATIC compilation_test.c)
target_link_libraries(test-compile-c11 PRIVATE ethash)
set_target_properties(test-compile-c11 PROPERTIES C_STANDARD 11 C_EXTENSIONS OFF)
15 changes: 15 additions & 0 deletions test/integration/compilation/compilation_test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* ethash: C/C++ implementation of Ethash, the Ethereum Proof of Work algorithm.
* Copyright 2018 Pawel Bylica.
* Licensed under the Apache License, Version 2.0. See the LICENSE file.
*/

#include <ethash/ethash.h>

int test()
{
int sum = 0;
sum += ETHASH_EPOCH_LENGTH;
sum += ETHASH_LIGHT_CACHE_ITEM_SIZE;
sum += ETHASH_FULL_DATASET_ITEM_SIZE;
return sum;
}

0 comments on commit 9551b59

Please sign in to comment.