This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

wcscmp testsuite too strict



While experimenting with an alternative wcscmp implementation, I found that
the testsuite wcscmp is too strict: it prescribes the precise return value
where in fact only the sign matters.


2000-09-30  Bruno Haible  <haible@clisp.cons.org>

	* tests-mbwc/tst_wcscmp.c (tst_wcscmp): Take the sign of ret.
	* tests-mbwc/dat_wcscmp.c (tst_wcscmp_loc): Don't expect precise
	return values. Only the sign matters.

*** glibc-20000928/localedata/tests-mbwc/tst_wcscmp.c.bak	Tue Jun 27 17:53:19 2000
--- glibc-20000928/localedata/tests-mbwc/tst_wcscmp.c	Fri Sep 29 01:03:37 2000
***************
*** 23,28 ****
--- 23,29 ----
        ws1 = TST_INPUT (wcscmp).ws1;
        ws2 = TST_INPUT (wcscmp).ws2;
        ret = wcscmp (ws1, ws2);
+       ret = (ret > 0 ? 1 : ret < 0 ? -1 : 0);
  
        if (debug_flg)
  	{
*** glibc-20000928/localedata/tests-mbwc/dat_wcscmp.c.bak	Fri Aug 18 18:40:52 2000
--- glibc-20000928/localedata/tests-mbwc/dat_wcscmp.c	Fri Sep 29 01:03:37 2000
***************
*** 26,52 ****
        },
        { /*input.*/ { { 0x00D1,0x00D1,0x00D3,0x0000 },
  		     { 0x0000,0x00D2,0x00D3,0x0000 }, },  /* #3 */
! 	/*expect*/ { 0,1,0x00D1,			  },
        },
        { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
  		     { 0x00D1,0x00D1,0x00D3,0x0000 }, },  /* #4 */
! 	/*expect*/ { 0,1,-0x00D1,			  },
        },
        { /*input.*/ { { 0x00D1,0x00D5,0x00D3,0x0000 },
  		     { 0x00D1,0x00D2,0x00D3,0x0000 }, },  /* #5 */
! 	/*expect*/ { 0,1,3,			  },
        },
        { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
  		     { 0x00D1,0x00D2,0x00D9,0x0000 }, },  /* #6 */
! 	/*expect*/ { 0,1,-6,			  },
        },
        { /*input.*/ { { 0x00D1,0x00D2,0x0000	       },
  		     { 0x00D1,0x00D2,0x00D9,0x0000 }, },  /* #7 */
! 	/*expect*/ { 0,1,-0x00D9,			  },
        },
        { /*input.*/ { { 0x00D1,0x00D2,0x00D9,0x0000 },
  		     { 0x00D1,0x00D2,0x0000	       }, },  /* #8 */
! 	/*expect*/ { 0,1,0x00D9,			  },
        },
        { is_last: 1 }
      }
--- 26,52 ----
        },
        { /*input.*/ { { 0x00D1,0x00D1,0x00D3,0x0000 },
  		     { 0x0000,0x00D2,0x00D3,0x0000 }, },  /* #3 */
! 	/*expect*/ { 0,1,1,			  },
        },
        { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
  		     { 0x00D1,0x00D1,0x00D3,0x0000 }, },  /* #4 */
! 	/*expect*/ { 0,1,-1,			  },
        },
        { /*input.*/ { { 0x00D1,0x00D5,0x00D3,0x0000 },
  		     { 0x00D1,0x00D2,0x00D3,0x0000 }, },  /* #5 */
! 	/*expect*/ { 0,1,1,			  },
        },
        { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
  		     { 0x00D1,0x00D2,0x00D9,0x0000 }, },  /* #6 */
! 	/*expect*/ { 0,1,-1,			  },
        },
        { /*input.*/ { { 0x00D1,0x00D2,0x0000	       },
  		     { 0x00D1,0x00D2,0x00D9,0x0000 }, },  /* #7 */
! 	/*expect*/ { 0,1,-1,			  },
        },
        { /*input.*/ { { 0x00D1,0x00D2,0x00D9,0x0000 },
  		     { 0x00D1,0x00D2,0x0000	       }, },  /* #8 */
! 	/*expect*/ { 0,1,1,			  },
        },
        { is_last: 1 }
      }
***************
*** 64,90 ****
        },
        { /*input.*/ { { 0x0041,0x0041,0x0043,0x0000 },
  		     { 0x0000,0x0042,0x0043,0x0000 }, },  /* #3 */
! 	/*expect*/ { 0,1,0x0041,			  },
        },
        { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
  		     { 0x0041,0x0041,0x0043,0x0000 }, },  /* #4 */
! 	/*expect*/ { 0,1,-0x0041,			  },
        },
        { /*input.*/ { { 0x0041,0x0045,0x0043,0x0000 },
  		     { 0x0041,0x0042,0x0043,0x0000 }, },  /* #5 */
! 	/*expect*/ { 0,1,3,			  },
        },
        { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
  		     { 0x0041,0x0042,0x0049,0x0000 }, },  /* #6 */
! 	/*expect*/ { 0,1,-6,			  },
        },
        { /*input.*/ { { 0x0041,0x0042,0x0000	       },
  		     { 0x0041,0x0042,0x0049,0x0000 }, },  /* #7 */
! 	/*expect*/ { 0,1,-0x0049,			  },
        },
        { /*input.*/ { { 0x0041,0x0042,0x0049,0x0000 },
  		     { 0x0041,0x0042,0x0000	       }, },  /* #8 */
! 	/*expect*/ { 0,1,0x0049,			  },
        },
        { is_last: 1 }
      }
--- 64,90 ----
        },
        { /*input.*/ { { 0x0041,0x0041,0x0043,0x0000 },
  		     { 0x0000,0x0042,0x0043,0x0000 }, },  /* #3 */
! 	/*expect*/ { 0,1,1,			  },
        },
        { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
  		     { 0x0041,0x0041,0x0043,0x0000 }, },  /* #4 */
! 	/*expect*/ { 0,1,-1,			  },
        },
        { /*input.*/ { { 0x0041,0x0045,0x0043,0x0000 },
  		     { 0x0041,0x0042,0x0043,0x0000 }, },  /* #5 */
! 	/*expect*/ { 0,1,1,			  },
        },
        { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
  		     { 0x0041,0x0042,0x0049,0x0000 }, },  /* #6 */
! 	/*expect*/ { 0,1,-1,			  },
        },
        { /*input.*/ { { 0x0041,0x0042,0x0000	       },
  		     { 0x0041,0x0042,0x0049,0x0000 }, },  /* #7 */
! 	/*expect*/ { 0,1,-1,			  },
        },
        { /*input.*/ { { 0x0041,0x0042,0x0049,0x0000 },
  		     { 0x0041,0x0042,0x0000	       }, },  /* #8 */
! 	/*expect*/ { 0,1,1,			  },
        },
        { is_last: 1 }
      }
***************
*** 102,128 ****
        },
        { /*input.*/ { { 0x3041,0x3041,0x3043,0x0000 },
  		     { 0x0000,0x3042,0x3043,0x0000 }, },  /* #3 */
! 	/*expect*/ { 0,1,0x3041,			  },
        },
        { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
  		     { 0x3041,0x3041,0x3043,0x0000 }, },  /* #4 */
! 	/*expect*/ { 0,1,-0x3041,			  },
        },
        { /*input.*/ { { 0x3041,0x3045,0x3043,0x0000 },
  		     { 0x3041,0x3042,0x3043,0x0000 }, },  /* #5 */
! 	/*expect*/ { 0,1,3,			  },
        },
        { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
  		     { 0x3041,0x3042,0x3049,0x0000 }, },  /* #6 */
! 	/*expect*/ { 0,1,-6,			  },
        },
        { /*input.*/ { { 0x3041,0x3042,0x0000	       },
  		     { 0x3041,0x3042,0x3049,0x0000 }, },  /* #7 */
! 	/*expect*/ { 0,1,-0x3049,			  },
        },
        { /*input.*/ { { 0x3041,0x3042,0x3049,0x0000 },
  		     { 0x3041,0x3042,0x0000	       }, },  /* #8 */
! 	/*expect*/ { 0,1,0x3049,			  },
        },
        { is_last: 1 }
      }
--- 102,128 ----
        },
        { /*input.*/ { { 0x3041,0x3041,0x3043,0x0000 },
  		     { 0x0000,0x3042,0x3043,0x0000 }, },  /* #3 */
! 	/*expect*/ { 0,1,1,			  },
        },
        { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
  		     { 0x3041,0x3041,0x3043,0x0000 }, },  /* #4 */
! 	/*expect*/ { 0,1,-1,			  },
        },
        { /*input.*/ { { 0x3041,0x3045,0x3043,0x0000 },
  		     { 0x3041,0x3042,0x3043,0x0000 }, },  /* #5 */
! 	/*expect*/ { 0,1,1,			  },
        },
        { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
  		     { 0x3041,0x3042,0x3049,0x0000 }, },  /* #6 */
! 	/*expect*/ { 0,1,-1,			  },
        },
        { /*input.*/ { { 0x3041,0x3042,0x0000	       },
  		     { 0x3041,0x3042,0x3049,0x0000 }, },  /* #7 */
! 	/*expect*/ { 0,1,-1,			  },
        },
        { /*input.*/ { { 0x3041,0x3042,0x3049,0x0000 },
  		     { 0x3041,0x3042,0x0000	       }, },  /* #8 */
! 	/*expect*/ { 0,1,1,			  },
        },
        { is_last: 1 }
      }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]