1. 01 Aug, 2015 2 commits
    • David Gibson's avatar
      aga: Simple test graphs · 2192bdd9
      David Gibson authored
      This adds code for a number of example graphs for use in tests of the aga
      module.  They also demonstrate several different ways of constructing
      graphs using the aga callbacks.
      
      It adds one actual testcase, which just verifies that the example graph
      look like what they're supposed to.  Specifically it computes a set of
      adjacency lists for the example graphs from the callback code, then
      compares that to a canned example of what it should be.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      2192bdd9
    • David Gibson's avatar
      aga: Abstract Graph Algorithms · 3b7409ea
      David Gibson authored
      New module.
      
      This patch just adds the module, with some generic helper routines, no
      actual algorithms are implemented yet.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      3b7409ea
  2. 30 Jul, 2015 2 commits
  3. 20 Jul, 2015 1 commit
  4. 09 Jul, 2015 7 commits
  5. 08 Jul, 2015 3 commits
  6. 25 Jun, 2015 2 commits
  7. 18 Jun, 2015 5 commits
    • David Gibson's avatar
      avl: Use definitions from order module · 712dc43d
      David Gibson authored
      The AvlCompare type defined in the avl module is identical in signature to
      the compare function used by qsort() and bsearch().  That has a common
      definition in the new order module, so use that rather than defining its
      own.
      
      In addition use the standard comparison functions from order where possible
      for the avl test code.
      
      Cc: Joey Adams <joeyadams3.14159@gmail.com>
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      712dc43d
    • David Gibson's avatar
      asort: Use order module definitions · 918a733f
      David Gibson authored
      The asort routine takes a user-supplied comparison function.  Use the
      definitions from the new order module to slightly simplify the declaration
      and handling of this function.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      918a733f
    • David Gibson's avatar
      order: Scalar comparison functions · 37825438
      David Gibson authored
      Extend the order module to provide simple, standard, comparison
      callbacks for scalar types (i.e. integer and floating point types).
      
      In addition to the usual variants comparing a plain scalar, this also
      provides helper macros to construct a suitably typed callback and context
      pointer to order structures by a specified scalar field.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      37825438
    • David Gibson's avatar
      order: Module for comparison callbacks · c2a3098b
      David Gibson authored
      Many common algorithms take a callback for comparing items - effectively
      giving the items a user defined order.
      
      For example, the standard library qsort() and bsearch() routines take such
      a callback.  The ccan/avl module takes an identical one.  The ccan/asort
      and ccan/asearch modules use a different variant: their callback takes an
      additional context parameter, and is also typed via use of macros and
      typesafe_cb.
      
      This module provides helper types and macros for easily declaring any of
      the common variants on comparison functions: the 2-parameter untyped form
      (as used by qsort), the 3-parameter untyped form (used by the asort back
      end) and the 3-parameter typed form (used by the asort front end).  It
      provides a wrapper macro for doing the typesafe_cb conversion from
      3-parameter typed to 3-parameter untyped.
      
      It also provides a container struct to describe both a comparison callback
      and a context value as a single structure.  This also comes in both
      untyped and typed variants.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      c2a3098b
    • Rusty Russell's avatar
      ccanlint: handle circular test-depends. · 04b63db6
      Rusty Russell authored
      eg. asort depends on order, but order testdepends on asort.
      
      Probably not the greatest thing to do, but don't barf because of it.
      Reported-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      04b63db6
  8. 13 Jun, 2015 2 commits
  9. 04 Jun, 2015 1 commit
  10. 02 Jun, 2015 1 commit
  11. 01 Jun, 2015 2 commits
  12. 28 May, 2015 4 commits
  13. 27 May, 2015 4 commits
  14. 25 May, 2015 4 commits