Exemple #1
0
def test_sut_sample_oracle():
    """
    Use sample oracle to test the SUT.
    """

    assert_almost_equal(sut_sin(  0.0), 0.0)
    assert_almost_equal(sut_sin( 90.0), 1.0)
    assert_almost_equal(sut_sin(180.0), 0.0)
    assert_almost_equal(sut_sin(270.0),-1.0)
    assert_almost_equal(sut_sin(360.0), 0.0)
Exemple #2
0
def draw_chart():
    """Draws sample chart"""
    title("Sample SUT sin(x)")
    xlabel('Angle')
    ylabel('sin(x)')

    x = xrange(0, 361)
    y = [sut_sin(i) for i in x] 
    
    plot(x, y, linewidth=1.0, color='b')

    axes().axis([0, None, None, None])
    axis('tight')

    #linestyle '--', '-.', ':', '_'
    grid(True, color='grey', alpha=0.25, linestyle=':')

    #legend(loc=0) # 0 for optimized legend placement

    savefig(basename(__file__).split('.')[0]+'.png')