code: def __validate_rqa_results(
      rec, score, path, gap_onset, gap_extend, backtrack, knight
  ):
      # Test maximal end-point
      assert np.all(score[tuple(path[-1])] >= score)
  
      # Test non-zero start point
      assert rec[tuple(path[0])] > 0
  
      # If we can't have gaps, then all values must be nonzero
      if not np.isfinite(gap_onset) and not np.isfinite(gap_extend):
          assert np.all([rec[tuple(i)] > 0 for i in path])
  
      path_diff = np.diff(path, axis=0)
      if knight:
          for d in path_diff:
              assert (
                  np.allclose(d, (1, 1))
                  or np.allclose(d, (1, 2))
                  or np.allclose(d, (2, 1))
              )
      else:
          # Without knight moves, only diagonal steps are allowed
          assert np.allclose(path_diff, 1)
  
imports: import numpy
  import pytest
  from test_core import srand
  import librosa
label_desc: Use image node_id 40 for calling a global function with example usage: __validate_rqa_results(rec, score, path, gap_onset, gap_extend, backtrack, knight) without return types