mirror of
https://github.com/ml-explore/mlx.git
synced 2025-09-03 22:34:43 +08:00
jagrit's commit files
This commit is contained in:
26
tests/utils_tests.cpp
Normal file
26
tests/utils_tests.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
#include "doctest/doctest.h"
|
||||
|
||||
#include "mlx/mlx.h"
|
||||
|
||||
using namespace mlx::core;
|
||||
|
||||
TEST_CASE("test type promotion") {
|
||||
for (auto t : {bool_, uint32, int32, int64, float32}) {
|
||||
auto a = array(0, t);
|
||||
CHECK_EQ(result_type({a}), t);
|
||||
|
||||
std::vector<array> arrs = {array(0, t), array(0, t)};
|
||||
CHECK_EQ(result_type(arrs), t);
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<array> arrs = {array(false), array(0, int32)};
|
||||
CHECK_EQ(result_type(arrs), int32);
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<array> arrs = {array(0, int32), array(false), array(0.0f)};
|
||||
CHECK_EQ(result_type(arrs), float32);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user