changeset 2637:0e554b247bbd octave-forge

added proper test case for shannonfanodict.m as David pointed out.
author gnumuthu
date Mon, 09 Oct 2006 16:06:33 +0000
parents d425be1bdc29
children d2a6ba4f9e96
files main/comm/inst/riceenco.m main/comm/inst/shannonfanodict.m
diffstat 2 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/main/comm/inst/riceenco.m	Mon Oct 09 14:26:21 2006 +0000
+++ b/main/comm/inst/riceenco.m	Mon Oct 09 16:06:33 2006 +0000
@@ -59,6 +59,8 @@
 	. Accepts only non-negative numbers. Cannot encode.");
   end
 
+  error('FIXME: Has a Bug in the used region handling');
+  
   L=length(sig);
 
   %compute the optimal rice parameter.
--- a/main/comm/inst/shannonfanodict.m	Mon Oct 09 14:26:21 2006 +0000
+++ b/main/comm/inst/shannonfanodict.m	Mon Oct 09 16:06:33 2006 +0000
@@ -112,11 +112,15 @@
    return;
 end
 
+%!shared CW,P
+%!test
+%!  addpath('../../info-theory/inst')
+%!  P  = [0.5 0.25 0.15 0.1];
+%!  CW = shannonfanodict(1:4,P);
 %!
-%!CW=shannonfanodict(1:4,[0.5 0.25 0.15 0.1]);
-%!assert(redundancy(CW,[0.5 0.25 0.15 0.1]),0.057980,0.001)
-%!CW=shannonfanodict(1:4,[0.5 0.15 0.25 0.1]);
-%!P=[0.5 0.25 0.15 0.1 0];
-%!CW=shannonfanodict(1:5,P);
-%!redundancy(CW,P)
+%!assert(redundancy(CW,P),0.057980,0.001)
+%!test
+%!  P =[0.5 0.25 0.15 0.1 0];
+%!  CW=shannonfanodict(1:4,[0.5 0.15 0.25 0.1]);
+%!assert(redundancy(CW,P),0.10629,1e-4);
 %!