xref: /aosp_15_r20/external/executorch/kernels/test/op_logical_and_test.cpp (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 #include <executorch/kernels/test/BinaryLogicalOpTest.h>
10 #include <executorch/kernels/test/FunctionHeaderWrapper.h> // Declares the operator
11 
12 #include <gtest/gtest.h>
13 
14 using exec_aten::Tensor;
15 
16 class OpLogicalAndTest : public torch::executor::testing::BinaryLogicalOpTest {
17  protected:
op_out(const Tensor & self,const Tensor & other,Tensor & out)18   Tensor& op_out(const Tensor& self, const Tensor& other, Tensor& out)
19       override {
20     return torch::executor::aten::logical_and_outf(context_, self, other, out);
21   }
22 
op_reference(double x,double y) const23   double op_reference(double x, double y) const override {
24     uint64_t lhs, rhs;
25     std::memcpy(&lhs, &x, sizeof(lhs));
26     std::memcpy(&rhs, &y, sizeof(rhs));
27     return lhs && rhs;
28   }
29 };
30 
31 IMPLEMENT_BINARY_LOGICAL_OP_TEST(OpLogicalAndTest)
32