| 
									
										
										
										
											2025-03-27 19:30:58 -07:00
										 |  |  | # Doctest works fine with cmake 3.5
 | 
					
						
							|  |  |  | set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-29 10:30:41 -08:00
										 |  |  | FetchContent_Declare( | 
					
						
							|  |  |  |   doctest
 | 
					
						
							|  |  |  |   GIT_REPOSITORY "https://github.com/onqtam/doctest"
 | 
					
						
							| 
									
										
										
										
											2024-09-16 20:53:01 +01:00
										 |  |  |   GIT_TAG "ae7a13539fb71f270b87eb2e874fbac80bc8dda2")
 | 
					
						
							| 
									
										
										
										
											2023-11-29 10:30:41 -08:00
										 |  |  | FetchContent_MakeAvailable(doctest)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | add_executable(tests ${PROJECT_SOURCE_DIR}/tests/tests.cpp)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-16 20:53:01 +01:00
										 |  |  | if(MLX_BUILD_METAL)
 | 
					
						
							|  |  |  |   set(METAL_TEST_SOURCES metal_tests.cpp)
 | 
					
						
							| 
									
										
										
										
											2023-11-29 10:30:41 -08:00
										 |  |  | endif()
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-19 10:03:56 -05:00
										 |  |  | include(${doctest_SOURCE_DIR}/scripts/cmake/doctest.cmake)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-16 20:53:01 +01:00
										 |  |  | target_sources( | 
					
						
							|  |  |  |   tests
 | 
					
						
							|  |  |  |   PRIVATE allocator_tests.cpp
 | 
					
						
							|  |  |  |           array_tests.cpp
 | 
					
						
							|  |  |  |           arg_reduce_tests.cpp
 | 
					
						
							|  |  |  |           autograd_tests.cpp
 | 
					
						
							|  |  |  |           blas_tests.cpp
 | 
					
						
							|  |  |  |           compile_tests.cpp
 | 
					
						
							|  |  |  |           custom_vjp_tests.cpp
 | 
					
						
							|  |  |  |           creations_tests.cpp
 | 
					
						
							|  |  |  |           device_tests.cpp
 | 
					
						
							|  |  |  |           einsum_tests.cpp
 | 
					
						
							| 
									
										
										
										
											2024-12-24 11:19:13 -08:00
										 |  |  |           export_import_tests.cpp
 | 
					
						
							| 
									
										
										
										
											2024-09-16 20:53:01 +01:00
										 |  |  |           eval_tests.cpp
 | 
					
						
							|  |  |  |           fft_tests.cpp
 | 
					
						
							|  |  |  |           load_tests.cpp
 | 
					
						
							|  |  |  |           ops_tests.cpp
 | 
					
						
							|  |  |  |           random_tests.cpp
 | 
					
						
							|  |  |  |           scheduler_tests.cpp
 | 
					
						
							|  |  |  |           utils_tests.cpp
 | 
					
						
							|  |  |  |           vmap_tests.cpp
 | 
					
						
							|  |  |  |           linalg_tests.cpp
 | 
					
						
							|  |  |  |           ${METAL_TEST_SOURCES})
 | 
					
						
							| 
									
										
										
										
											2023-11-29 10:30:41 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | target_link_libraries(tests PRIVATE mlx doctest)
 | 
					
						
							| 
									
										
										
										
											2024-02-19 10:03:56 -05:00
										 |  |  | doctest_discover_tests(tests)
 | 
					
						
							| 
									
										
										
										
											2023-11-29 10:30:41 -08:00
										 |  |  | add_test(NAME tests COMMAND tests)
 |