codec_pref: move match_codec_pref() to separate c-file and add unit-test

At the moment there are three sources that may advertise a list of
supported audio codec/rate settings. There is the MS that advertises
advertises a speech codec list and the MSC that sends a channel type
information element over A and there are also settings in the bsc
configuration file that may restrict the codec/rate types that are
allowed to use.

The function match_codec_pref() looks at all of the three buckets and
selects a codec that satisfies all three. This is already a somewhat
complicated process, overit is very isolated, so lets give it its own
c-file.

Due to the lack of unit-tests it is very hard to make changes here so
lets add also unit-test to make sure that regressions are catched early.

- Put match_codec_pref() and all its helper functions into a separate
  c-file.
- Add a unit test.

Change-Id: Iabedfdcec8b99a319f2d57cbea45c5e36c7b6e29
Related: OS#3361
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 515ffa0..f384655 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -26,6 +26,12 @@
 AT_CHECK([$abs_top_builddir/tests/bsc/bsc_test], [], [expout], [ignore])
 AT_CLEANUP
 
+AT_SETUP([codec_pref])
+AT_KEYWORDS([codec_pref])
+cat $abs_srcdir/codec_pref/codec_pref_test.ok > expout
+AT_CHECK([$abs_top_builddir/tests/codec_pref/codec_pref_test], [], [expout], [ignore])
+AT_CLEANUP
+
 AT_SETUP([nanobts_omlattr])
 AT_KEYWORDS([nanobts_omlattr])
 cat $abs_srcdir/nanobts_omlattr/nanobts_omlattr_test.ok > expout