<s> from __future__ import print_function , absolute_import , division <EOL> import numpy as np <EOL> from numba . cuda . testing import unittest <EOL> from numba import cuda <EOL> import operator <EOL> class TestOperatorModule ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def operator_template ( self , op ) : <EOL> @ cuda . jit <EOL> def foo ( a , b ) : <EOL> i = <NUM_LIT:0> <EOL> a [ i ] = op ( a [ i ] , b [ i ] ) <EOL> a = np . ones ( <NUM_LIT:1> ) <EOL> b = np . ones ( <NUM_LIT:1> ) <EOL> res = a . copy ( ) <EOL> foo [ <NUM_LIT:1> , <NUM_LIT:1> ] ( res , b ) <EOL> np . testing . assert_equal ( res , op ( a , b ) ) <EOL> def test_add ( self ) : <EOL> self . operator_template ( operator . add ) <EOL> def test_sub ( self ) : <EOL> self . operator_template ( operator . sub ) <EOL> def test_mul ( self ) : <EOL> self . operator_template ( operator . mul ) <EOL> def test_truediv ( self ) : <EOL> self . operator_template ( operator . truediv ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
