Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 33995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:00:32+00:00 2026-05-10T14:00:32+00:00

I would like to test a function with a tuple from a set of

  • 0

I would like to test a function with a tuple from a set of fringe cases and normal values. For example, while testing a function which returns true whenever given three lengths that form a valid triangle, I would have specific cases, negative / small / large numbers, values close-to being overflowed, etc.; what is more, main aim is to generate combinations of these values, with or without repetition, in order to get a set of test data.

(inf,0,-1), (5,10,1000), (10,5,5), (0,-1,5), (1000,inf,inf), ... 

As a note: I actually know the answer to this, but it might be helpful for others, and a challenge for people here! –will post my answer later on.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T14:00:32+00:00Added an answer on May 10, 2026 at 2:00 pm

    Absolutely, especially dealing with lots of these permutations/combinations I can definitely see that the first pass would be an issue.

    Interesting implementation in python, though I wrote a nice one in C and Ocaml based on ‘Algorithm 515’ (see below). He wrote his in Fortran as it was common back then for all the ‘Algorithm XX’ papers, well, that assembly or c. I had to re-write it and make some small improvements to work with arrays not ranges of numbers. This one does random access, I’m still working on getting some nice implementations of the ones mentioned in Knuth 4th volume fascicle 2. I’ll an explanation of how this works to the reader. Though if someone is curious, I wouldn’t object to writing something up.

    /** [combination c n p x]  * get the [x]th lexicographically ordered set of [p] elements in [n]  * output is in [c], and should be sizeof(int)*[p] */ void combination(int* c,int n,int p, int x){     int i,r,k = 0;     for(i=0;i<p-1;i++){         c[i] = (i != 0) ? c[i-1] : 0;         do {             c[i]++;             r = choose(n-c[i],p-(i+1));             k = k + r;         } while(k < x);         k = k - r;     }     c[p-1] = c[p-2] + x - k; } 

    ~’Algorithm 515: Generation of a Vector from the Lexicographical Index’; Buckles, B. P., and Lybanon, M. ACM Transactions on Mathematical Software, Vol. 3, No. 2, June 1977.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 71k
  • Answers 71k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer OK, ok, a correction: you cannot define the <build> element… May 11, 2026 at 1:20 pm
  • added an answer filladapt.el does the trick. That with the latest version of… May 11, 2026 at 1:20 pm
  • added an answer It is probably an exception. Perhaps you're running with different… May 11, 2026 at 1:20 pm

Related Questions

No related questions found

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.