
import shtest, sys, math

def cbrt(l, types=[]):
    return shtest.make_test([math.pow(x, 1/3.0) for x in l], [l], types)

def insert_into(test):
    test.add_test(cbrt((0.0, 1.0, 2.0, 3.0)))
    test.add_test(cbrt((1.0,)))
    test.add_make_test((3,), [(27,)], ['i', 'i'])

# Test the cube root in stream programs
test = shtest.StreamTest('cbrt', 1)
test.add_call(shtest.Call(shtest.Call.call, 'cbrt', 1))
insert_into(test)
test.output_header(sys.stdout)
test.output(sys.stdout, False)

# Test the cube root in immediate mode
test = shtest.ImmediateTest('cbrt_im', 1)
test.add_call(shtest.Call(shtest.Call.call, 'cbrt', 1))
insert_into(test)
test.output(sys.stdout, False)

test.output_footer(sys.stdout)


import shtest, sys, math

def cbrt(l, types=[]):
    return shtest.make_test([math.pow(x, 1/3.0) for x in l], [l], types)

def insert_into(test):
    test.add_test(cbrt((0.0, 1.0, 2.0, 3.0)))
    test.add_test(cbrt((1.0,)))
    test.add_test(cbrt((4000.2, 27)))
    #test.add_make_test((3,), [(27,)], ['i', 'i']) # not currently working

# Test the cube root in stream programs
test = shtest.StreamTest('cbrt', 1)
test.add_call(shtest.Call(shtest.Call.call, 'cbrt', 1))
insert_into(test)
test.output_header(sys.stdout)
test.output(sys.stdout, False)

# Test the cube root in immediate mode
test = shtest.ImmediateTest('cbrt_im', 1)
test.add_call(shtest.Call(shtest.Call.call, 'cbrt', 1))
insert_into(test)
test.output(sys.stdout, False)

test.output_footer(sys.stdout)

Add a typical 2-component case. Comment out a case that fail until integer support is fixed.
Add a typical 2-component case.
Comment out a case that fail until integer support is fixed.


git-svn-id: f6f47f0a6375c1440c859a5b92b3b3fbb75bb58e@2508 afdca40c-03d6-0310-8ede-e9f093b21075

  
  import shtest, sys, math
  
  def cbrt(l, types=[]):
      return shtest.make_test([math.pow(x, 1/3.0) for x in l], [l], types)
  
  def insert_into(test):
      test.add_test(cbrt((0.0, 1.0, 2.0, 3.0)))
      test.add_test(cbrt((1.0,)))
+     test.add_test(cbrt((4000.2, 27)))
-     test.add_make_test((3,), [(27,)], ['i', 'i'])
+     #test.add_make_test((3,), [(27,)], ['i', 'i']) # not currently working
  
  # Test the cube root in stream programs
  test = shtest.StreamTest('cbrt', 1)
  test.add_call(shtest.Call(shtest.Call.call, 'cbrt', 1))
  insert_into(test)
  test.output_header(sys.stdout)
  test.output(sys.stdout, False)
  
  # Test the cube root in immediate mode
  test = shtest.ImmediateTest('cbrt_im', 1)
  test.add_call(shtest.Call(shtest.Call.call, 'cbrt', 1))
  insert_into(test)
  test.output(sys.stdout, False)
  
  test.output_footer(sys.stdout)
  
Add a typical 2-component case. Comment out a case that fail until integer support is fixed.
## Code Before:

import shtest, sys, math

def cbrt(l, types=[]):
    return shtest.make_test([math.pow(x, 1/3.0) for x in l], [l], types)

def insert_into(test):
    test.add_test(cbrt((0.0, 1.0, 2.0, 3.0)))
    test.add_test(cbrt((1.0,)))
    test.add_make_test((3,), [(27,)], ['i', 'i'])

# Test the cube root in stream programs
test = shtest.StreamTest('cbrt', 1)
test.add_call(shtest.Call(shtest.Call.call, 'cbrt', 1))
insert_into(test)
test.output_header(sys.stdout)
test.output(sys.stdout, False)

# Test the cube root in immediate mode
test = shtest.ImmediateTest('cbrt_im', 1)
test.add_call(shtest.Call(shtest.Call.call, 'cbrt', 1))
insert_into(test)
test.output(sys.stdout, False)

test.output_footer(sys.stdout)

## Instruction:
Add a typical 2-component case. Comment out a case that fail until integer support is fixed.
## Code After:

import shtest, sys, math

def cbrt(l, types=[]):
    return shtest.make_test([math.pow(x, 1/3.0) for x in l], [l], types)

def insert_into(test):
    test.add_test(cbrt((0.0, 1.0, 2.0, 3.0)))
    test.add_test(cbrt((1.0,)))
    test.add_test(cbrt((4000.2, 27)))
    #test.add_make_test((3,), [(27,)], ['i', 'i']) # not currently working

# Test the cube root in stream programs
test = shtest.StreamTest('cbrt', 1)
test.add_call(shtest.Call(shtest.Call.call, 'cbrt', 1))
insert_into(test)
test.output_header(sys.stdout)
test.output(sys.stdout, False)

# Test the cube root in immediate mode
test = shtest.ImmediateTest('cbrt_im', 1)
test.add_call(shtest.Call(shtest.Call.call, 'cbrt', 1))
insert_into(test)
test.output(sys.stdout, False)

test.output_footer(sys.stdout)
