| 763 | |
| 764 | template<typename T> |
| 765 | class Approx2V2 : public ::testing::Test { |
| 766 | protected: |
| 767 | typedef typename dtype_traits<T>::base_type BT; |
| 768 | |
| 769 | vector<T> h_gold_cast; |
| 770 | vector<T> h_in_cast; |
| 771 | vector<BT> h_pos1_cast; |
| 772 | vector<BT> h_pos2_cast; |
| 773 | |
| 774 | dim4 gold_dims; |
| 775 | dim4 in_dims; |
| 776 | dim4 pos1_dims; |
| 777 | dim4 pos2_dims; |
| 778 | |
| 779 | af_array gold; |
| 780 | af_array in; |
| 781 | af_array pos1; |
| 782 | af_array pos2; |
| 783 | |
| 784 | Approx2V2() : gold(0), in(0), pos1(0), pos2(0) {} |
| 785 | |
| 786 | void SetUp() {} |
| 787 | |
| 788 | void releaseArrays() { |
| 789 | if (pos2 != 0) { ASSERT_SUCCESS(af_release_array(pos2)); } |
| 790 | if (pos1 != 0) { ASSERT_SUCCESS(af_release_array(pos1)); } |
| 791 | if (in != 0) { ASSERT_SUCCESS(af_release_array(in)); } |
| 792 | if (gold != 0) { ASSERT_SUCCESS(af_release_array(gold)); } |
| 793 | } |
| 794 | |
| 795 | void TearDown() { releaseArrays(); } |
| 796 | |
| 797 | void setTestData(float* h_gold, dim4 gold_dims, float* h_in, dim4 in_dims, |
| 798 | float* h_pos1, dim4 pos1_dims, float* h_pos2, |
| 799 | dim4 pos2_dims) { |
| 800 | releaseArrays(); |
| 801 | |
| 802 | gold = 0; |
| 803 | in = 0; |
| 804 | pos1 = 0; |
| 805 | pos2 = 0; |
| 806 | |
| 807 | this->gold_dims = gold_dims; |
| 808 | this->in_dims = in_dims; |
| 809 | this->pos1_dims = pos1_dims; |
| 810 | this->pos2_dims = pos2_dims; |
| 811 | |
| 812 | for (int i = 0; i < gold_dims.elements(); ++i) { |
| 813 | h_gold_cast.push_back(static_cast<T>(h_gold[i])); |
| 814 | } |
| 815 | for (int i = 0; i < in_dims.elements(); ++i) { |
| 816 | h_in_cast.push_back(static_cast<T>(h_in[i])); |
| 817 | } |
| 818 | for (int i = 0; i < pos1_dims.elements(); ++i) { |
| 819 | h_pos1_cast.push_back(static_cast<BT>(h_pos1[i])); |
| 820 | } |
| 821 | for (int i = 0; i < pos2_dims.elements(); ++i) { |
| 822 | h_pos2_cast.push_back(static_cast<BT>(h_pos2[i])); |
nothing calls this directly
no outgoing calls
no test coverage detected