Name for #=== based assertion 
Author Message
 Name for #=== based assertion

I've had several requests that an assertion based on #=== be added to
Test::Unit. While I think it's a fine idea, I haven't yet found a name
that seems to fit, so I thought I'd ask and see if anyone else can come
up with something decent.

Nathaniel

<:((><
+ - -
| RoleModel Software, Inc.
| EQUIP VI



Sun, 31 Jul 2005 11:05:05 GMT  
 Name for #=== based assertion

Quote:

> I've had several requests that an assertion based on #=== be added to
> Test::Unit. While I think it's a fine idea, I haven't yet found a name
> that seems to fit, so I thought I'd ask and see if anyone else can come
> up with something decent.

Maybe...

    assert_case_equal
    assert_not_case_equal

This comes from ri, which calls === "case equality"

squeaker% ri Object.===
------------------------------------------------------------- Object#===
     obj === anObject -> true or false
------------------------------------------------------------------------
     Case Equality---A synonym for Object#==, but typically overridden
     by descendents to provide meaningful semantics in case statements.

Has a double meaning -- case insensitive string compare, but I can't
think of anything better.

--
matt



Sun, 31 Jul 2005 13:54:30 GMT  
 Name for #=== based assertion

Quote:

> I've had several requests that an assertion based on #=== be added to
> Test::Unit. While I think it's a fine idea, I haven't yet found a name
> that seems to fit, so I thought I'd ask and see if anyone else can come
> up with something decent.

I've heard this operator called the "threequal" operator.

I've also heard it called the "case equality" operator (since it is used
by 'case').  I'm not sure if this is a good name, because /123/ ===
'foo123' has a truthful value, but I wouldn't call /123/ and 'foo123'
equal.

Paul



Sun, 31 Jul 2005 23:24:16 GMT  
 Name for #=== based assertion
Hi --


Quote:
> I've had several requests that an assertion based on #=== be added to
> Test::Unit. While I think it's a fine idea, I haven't yet found a name
> that seems to fit, so I thought I'd ask and see if anyone else can come
> up with something decent.

irb(main):007:0> def assert_case_of(x,y); x === y; end
=> nil
irb(main):008:0> assert_case_of(String, "abc")
=> true

David

--
David Alan Black


Web:  http://pirate.shu.edu/~blackdav



Sun, 31 Jul 2005 23:28:35 GMT  
 Name for #=== based assertion

Quote:
----- Original Message -----


Sent: Wednesday, February 12, 2003 9:24 AM
Subject: Re: Name for #=== based assertion



> > I've had several requests that an assertion based on #=== be added to
> > Test::Unit. While I think it's a fine idea, I haven't yet found a name
> > that seems to fit, so I thought I'd ask and see if anyone else can come
> > up with something decent.

> I've heard this operator called the "threequal" operator.

> I've also heard it called the "case equality" operator (since it is used
> by 'case').  I'm not sure if this is a good name, because /123/ ===
> 'foo123' has a truthful value, but I wouldn't call /123/ and 'foo123'
> equal.

I think "case equality" is the common term for it.
That term bothers me for essentially the reasons
you mention -- it isn't really "equality."

"Threequal" is cute. Never heard that one.

In TRW, I tended to say "relationship operator."
That's a little vague, and I can't remember where
I heard it. I'm pretty sure I didn't make it up.

Off the top of my head, I think "equivalence
operator" might be a good term. And I did make
that one up just now. ;)

Hal



Mon, 01 Aug 2005 05:41:53 GMT  
 Name for #=== based assertion
Hal E. Fulton said:

Quote:
> Off the top of my head, I think "equivalence
> operator" might be a good term. And I did make
> that one up just now. ;)

So you would suggest #assert_equivalent? It has a nice ring to it.
Objections?

Nathaniel



Mon, 01 Aug 2005 06:50:37 GMT  
 Name for #=== based assertion

Quote:
----- Original Message -----


Sent: Wednesday, February 12, 2003 4:50 PM
Subject: Re: Name for #=== based assertion

> Hal E. Fulton said:

> > Off the top of my head, I think "equivalence
> > operator" might be a good term. And I did make
> > that one up just now. ;)

> So you would suggest #assert_equivalent? It has a nice ring to it.
> Objections?

Hmm, I had ranged afield from the original topic.
I was talking terminology in general. :) I don't
have an opinion on that method name.

Probably assert_case_equal would be more intuitive
to more people. <shrug> But as I said, I don't
really have an opinion.

Hal



Mon, 01 Aug 2005 07:26:23 GMT  
 Name for #=== based assertion

Quote:

> Hal E. Fulton said:

>> Off the top of my head, I think "equivalence
>> operator" might be a good term. And I did make
>> that one up just now. ;)

> So you would suggest #assert_equivalent? It has a nice ring to it.
> Objections?

Yes, since in English "equivalent" and "equal" are more or less
equivalent.  ;-)

I would expect all of these to fail because the things are not
"equivalent":

    assert_equivalent(String, "foo")
    assert_equivalent((0..10), 5)
    assert_equivalent(/d/, "abcdefgh")

From Webster's Revised Unabridged Dictionary (1913) [web1913]:

  Equivalent \E*quiv"a*lent\, v. t.
     To make the equivalent to; to equal; equivalence. [R.]

Test::Unit should try to play on ==='s use in case statements, or make
something up.  E.g. in Ruby source === is called eqq:

enum.c:    id_eqq  = rb_intern("===");
object.c:    rb_define_method(rb_cModule, "===", rb_mod_eqq, 1);
parse.c:    {tEQQ,      "==="},
re.c:    rb_define_method(rb_cRegexp, "===", rb_reg_eqq, 1);

Mabye assert_eqqual?  :-P

--
matt



Mon, 01 Aug 2005 07:28:30 GMT  
 Name for #=== based assertion

Quote:
----- Original Message -----


Sent: Wednesday, February 12, 2003 5:28 PM
Subject: Re: Name for #=== based assertion

> Yes, since in English "equivalent" and "equal" are more or less
> equivalent.  ;-)

They may be equivalent, but they're not equal. ;-)*2

Just kidding. I see your point.

Quote:
> From Webster's Revised Unabridged Dictionary (1913) [web1913]:

>   Equivalent \E*quiv"a*lent\, v. t.
>      To make the equivalent to; to equal; equivalence. [R.]

This entry *really* confuses me. A transitive verb????
"A equivalents B." Never heard the like before. Is there
an entry for the adjective?

But in all seriousness, I personally think that "equivalent"
carries a connotation different from "equal." dictionary.com
(FWIW) says "something that is essentially equal to another."
I sumbit they say "essentially" for a reason. They also say
"equal, as in value, force, or meaning" (but they don't say
identity). Also: "having virtually identical or corresponding
parts." (Note "virtually.") However, in fairness, they also
say "Having similar or identical effects" where "identical"
implies more than similarity, but then they are talking about
the "effects" of the thing, not the thing itself.

Feel free to disagree. :) I promise I won't respond if you
do, as the subject rapidly grows silly.

Cheers,
Hal



Mon, 01 Aug 2005 07:45:36 GMT  
 Name for #=== based assertion

Quote:


> > Hal E. Fulton said:

> >> Off the top of my head, I think "equivalence
> >> operator" might be a good term. And I did make
> >> that one up just now. ;)

> > So you would suggest #assert_equivalent? It has a nice ring to it.
> > Objections?

> Yes, since in English "equivalent" and "equal" are more or
> less equivalent.  ;-)

Well, yes... although if I saw #assert_equivalent, it would at least
make me go, "What's the difference between that and #assert_equal?" Of
course, the fact that the name doesn't immediately spell out what that
difference is is an immediate point against it...

Quote:
> Test::Unit should try to play on ==='s use in case
> statements, or make something up.  E.g. in Ruby source === is
> called eqq:

> enum.c:    id_eqq  = rb_intern("===");
> object.c:    rb_define_method(rb_cModule, "===", rb_mod_eqq, 1);
> parse.c:    {tEQQ,      "==="},
> re.c:    rb_define_method(rb_cRegexp, "===", rb_reg_eqq, 1);

> Mabye assert_eqqual?  :-P

Or #assert_eqq? While a bit bizarre, that does have the advantage of
being short, distinguishable and memorable.

At this point I'm debating between #assert_case_equal and #assert_eqq. I
like the former's tie to the case statement, but dislike its
confusability with string case (upper or lower) and its length. Plus, it
just doesn't flow for me. The latter, well, I guess I already spelled
out what I do and don't like about it.

Nathaniel

<:((><
+ - -
| RoleModel Software, Inc.
| EQUIP VI



Mon, 01 Aug 2005 12:08:03 GMT  
 Name for #=== based assertion

On Wednesday, February 12, 2003, at 11:08 PM,

Quote:

> [snip]
> At this point I'm debating between #assert_case_equal and #assert_eqq.
> [snip]

How about assert_related


Mon, 01 Aug 2005 13:11:45 GMT  
 Name for #=== based assertion
Someone suggested "assert_case_of" and "assert_not_case_of" recently
in this thread.

I like it:

  assert_case_of( String, "hi" )

Regards,
Pit



Mon, 01 Aug 2005 16:03:08 GMT  
 Name for #=== based assertion

Quote:

> Or #assert_eqq? While a bit bizarre, that does have the advantage of
> being short, distinguishable and memorable.

Yes, maybe there is no good English word for "the === operator" so
inventing one is reasonable.

Quote:

> Someone suggested "assert_case_of" and "assert_not_case_of" recently
> in this thread.

> I like it:

>   assert_case_of( String, "hi" )

These works less well for Regexp.  E.g. this is true:

    assert_case_of(/x/, "fooxfoo")

Maybe borrow from Ruby's own use of === in "when" statements:

    assert_when(/x/, "fooxfoo")
    assert_when(String, "bar")
    assert_not_when(Array, "bar")

--
matt



Mon, 01 Aug 2005 17:34:39 GMT  
 Name for #=== based assertion

Quote:
> > Someone suggested "assert_case_of" and "assert_not_case_of" recently
> > in this thread.

> > I like it:

> >   assert_case_of( String, "hi" )

> These works less well for Regexp.  E.g. this is true:

>     assert_case_of(/x/, "fooxfoo")

Just as it was meant to :-)

In pseudo-code:

def assert_case_of( arg1, arg2 )
  case arg2
    when arg1
      # ok
    else
      fail( ... )
    end
  end
end

Quote:
> Maybe borrow from Ruby's own use of === in "when" statements:

I think it is called "case statement" and "when clause", but I'm not
sure.

Quote:
>     assert_when(/x/, "fooxfoo")
>     assert_when(String, "bar")
>     assert_not_when(Array, "bar")

To me as a non-native English speaker this doesn't read as good as
the others.

Regards,
Pit



Mon, 01 Aug 2005 19:29:36 GMT  
 Name for #=== based assertion

Quote:

> ----- Original Message -----

> > From Webster's Revised Unabridged Dictionary (1913) [web1913]:

> >   Equivalent \E*quiv"a*lent\, v. t.
> >      To make the equivalent to; to equal; equivalence. [R.]

> This entry *really* confuses me. A transitive verb????
> "A equivalents B." Never heard the like before. Is there
> an entry for the adjective?

From dict.org:

From Webster's Revised Unabridged Dictionary (1913) [web1913]:

  Equivalent \E*quiv"a*lent\, a. [L. aequivalens, -entis, p. pr.
     of aequivalere to have equal power; aequus equal + valere to
     be strong, be worth: cf. F. ['e]quivalent. See {Equal}, and
     {Valiant}.]
     1. Equal in wortir or value, force, power, effect, import,
        and the like; alike in significance and value; of the same
        import or meaning.

              For now to serve and to minister, servile and
              ministerial, are terms equivalent.    --South.

     2. (Geom.) Equal in measure but not admitting of
        superposition; -- applied to magnitudes; as, a square may
        be equivalent to a triangle.

(there is also a noun and a verb, but I don't think either is what we're
looking for).

Paul



Mon, 01 Aug 2005 22:52:58 GMT  
 
 [ 16 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Assertion-based verification

2. Assertion-based verification and Verilog-RTL

3. Assertion-based verification

4. Naming the output file based on awk script variable

5. Display names in browse based on dropdown box

6. PC based COBOL compiler, name a good one

7. Selecting Fields Based On Field Name

8. Getting the name of base class object in XOTCL

9. Transition from Clipper DOS based to Windows based Programming language

10. LOGO-L> Base 10 to Base 3

11. C-based simulation faster than HDL-based simulation?

12. how to convert vhdl based ROM to verilog based ROM

 

 
Powered by phpBB® Forum Software