Skip to content

Commit

Permalink
Add first basic test
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasbock committed Feb 7, 2022
1 parent d6c7853 commit 3015fd9
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 6 deletions.
4 changes: 3 additions & 1 deletion cpp_prototype/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ endif()
set(BML_BUILD_PYTHON_INTERFACE TRUE CACHE BOOL
"Build the Python API (requires Python dev package)")

project(bml ${LANGUAGES}) # don't move this line as it changes PROJECT_SOURCE_DIR
project(bml ${LANGUAGES})

add_subdirectory(src)

enable_testing()
add_subdirectory(tests)
3 changes: 3 additions & 0 deletions cpp_prototype/src/bml.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#ifndef __BML_H
#define __BML_H

#include "bml_types.h"
#include "bml_allocate.h"

#endif
4 changes: 3 additions & 1 deletion cpp_prototype/src/bml_allocate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ bml_identity_matrix(
int M,
bml_distribution_mode_t distrib_mode)
{
return NULL;
BMLMatrix * A = new BMLMatrix();

return A;
}
14 changes: 14 additions & 0 deletions cpp_prototype/src/bml_allocate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef __BML_ALLOCATE_H
#define __BML_ALLOCATE_H

#include "bml_types.h"

BMLMatrix *
bml_identity_matrix(
bml_matrix_type_t matrix_type,
bml_matrix_precision_t matrix_precision,
int N,
int M,
bml_distribution_mode_t distrib_mode);

#endif
19 changes: 19 additions & 0 deletions cpp_prototype/src/bml_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,25 @@ class BMLMatrix
int N;
};

/** The supported matrix types. */
typedef enum
{
/** The matrix is not initialized. */
type_uninitialized,
/** Dense matrix. */
dense,
/** ELLPACK matrix. */
ellpack,
/** BLOCK ELLPACK matrix. */
ellblock,
/** ELLSORT matrix. */
ellsort,
/** CSR matrix. */
csr,
/** distributed matrix. */
distributed2d
} bml_matrix_type_t;

/** The supported real precisions. */
typedef enum
{
Expand Down
7 changes: 4 additions & 3 deletions cpp_prototype/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
include_directories(${CMAKE_SOURCE_DIR}/src)
include_directories(${PROJECT_SOURCE_DIR}/src)
add_executable(bml-test
bml-test.cc)

add_test(NAME allocate COMMAND bml-test)
target_link_libraries(bml-test bml)
add_test(NAME allocate
COMMAND bml-test)
2 changes: 1 addition & 1 deletion cpp_prototype/tests/bml-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

int main() {
printf("starting tests\n");
return 1;
BMLMatrix * A = bml_identity_matrix(dense, double_real, 10, 10, sequential);
}

0 comments on commit 3015fd9

Please # to comment.