function valid_gmsh(varargin)
  % Only for code validation purpose
  %
  p = inputParser;
  p.KeepUnmatched=true; 
  p.addParamValue('basedir',default_dir(),@ischar); % select labels to draw
  p.parse(varargin{:});
  basedir=p.Results.basedir;
  assert(exist(basedir)==7,'basedir=%s is not a valid directory',basedir)
  LD=dir(basedir);
  LD=LD(3:end); % suppress '.' and '..'
  nLd=length(LD);
  for i=1:nLd
    if LD(i).isdir
      gmsh_bin=gmsh.locate(fullfile(basedir,LD(i).name));
      if ~isempty(gmsh_bin)
        fc_oogmsh.configure('gmsh_bin',gmsh_bin);
        if fc_tools.comp.isOctave(), clear -f;else clear functions; end % not needed for Matlab >= 2016a
        ver=gmsh.version();
        if strcmp(ver,'unknow'),ver=gmsh.command();end
        cmds{i}=gmsh.command();
        fprintf('\n\n CHECK GMSH VERSION %s\n\n',ver)
        valids{i}=fc_oogmsh.samples.allsamples(varargin{:});
        valid(i)=sum(valids{i});
        versions{i}=ver;
      else
        versions{i}='None';
        valids{i}=zeros(1,6);
        valid(i)=0;
      end
    end
  end
  fprintf('\n\nRESUME :\n')
  for i=1:nLd
    fprintf('[%d/%d] GMSH %s (%s)\n',i,nLd,versions{i},cmds{i})
    if valid(i)==length(valids{i})
      fprintf('     Tests : OK\n')
    else
      fprintf('     Tests : FAILED\n')
      fprintf('       -> sample%02d\n',find(valids{i}==0))
    end
  end
end

function basedir=default_dir()
  basedir='';
  if ispc()
    basedir='C:\Users\cuvelier\Softwares\GMSH\64-bit';
  elseif ismac()
    basedir='/Users/Cuvelier/GMSH';
  else
    basedir='/usr/local/GMSH/';
  end
end