How to test string library functions ?

Discussion in 'C++' started by codefixer@gmail.com, Mar 12, 2005.

  1. Guest

    Hi,

    Does anybody know how to test string library functions ?
    I have already gone through
    "gcc-3.4.1/gcc/testsuite/gcc.c-torture/execute" I want to know if
    their is any other way to test the same.


    Thanks.
    , Mar 12, 2005
    #1
    1. Advertising

  2. what exactly do you intend to test? Do you want to test if they behave
    as advertised?
    Raghu Uppalli, Mar 12, 2005
    #2
    1. Advertising

  3. Guest

    Raghu Uppalli wrote:
    > what exactly do you intend to test? Do you want to test if they

    behave
    > as advertised?


    Yes their functionality. How do you test strlen ? Can the string be
    varied from 0 through n ? OR Is their any other way of doing it ?
    Please feel free to share your thoughts.
    , Mar 12, 2005
    #3
  4. Howard Guest

    <> wrote in message
    news:...
    >
    > Raghu Uppalli wrote:
    >> what exactly do you intend to test? Do you want to test if they

    > behave
    >> as advertised?

    >
    > Yes their functionality. How do you test strlen ? Can the string be
    > varied from 0 through n ? OR Is their any other way of doing it ?
    > Please feel free to share your thoughts.
    >


    I don't know why you'd want to do such a test, but you know what it's
    supposed to do, right? So feed it some data and see if it gets the right
    answers. Test the empty string (just a null terminator in the first
    position). Test a bunch of strings whose length you know. Or make a large
    array, and loop through making it adding one character and testing the
    strlen function on it each time. There is no standard for such a test. And
    testing will only tell you that the test did not fail... it will not prove
    the correctness of the code. Seems like a waste of time to me, since the
    C++ compiler vendor had already done all that testing for you, at least if
    they're worth their salt! I pretty much rely on the correctness of my C++
    library and STL, otherwise I'd never be able to trust my own code, since it
    relies on what I've been provided as a tool base.

    -Howard
    Howard, Mar 14, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    10
    Views:
    726
    Joona I Palaste
    Sep 18, 2004
  2. Xiangliang Meng
    Replies:
    1
    Views:
    1,576
    Victor Bazarov
    Jun 21, 2004
  3. Kevin Easton

    Re: String and Math Library Functions

    Kevin Easton, Jun 26, 2003, in forum: C Programming
    Replies:
    0
    Views:
    745
    Kevin Easton
    Jun 26, 2003
  4. Steve
    Replies:
    4
    Views:
    417
    Roedy Green
    Oct 31, 2008
  5. Skybuck Flying

    Call oddities: &Test() vs &Test vs Test

    Skybuck Flying, Oct 4, 2009, in forum: C Programming
    Replies:
    1
    Views:
    680
    Skybuck Flying
    Oct 4, 2009
Loading...

Share This Page