~ubuntu-branches/ubuntu/utopic/dovecot/utopic-proposed

« back to all changes in this revision

Viewing changes to src/lib/test-unichar.c

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-01-08 09:35:49 UTC
  • mfrom: (4.1.35 sid)
  • Revision ID: package-import@ubuntu.com-20140108093549-i72o93pux8p0dlaf
Tags: 1:2.2.9-1ubuntu1
* Merge from Debian unstable, remaining changes:
  + Add mail-stack-delivery package:
    - Update d/rules
    - d/control: convert existing dovecot-postfix package to a dummy
      package and add new mail-stack-delivery package.
    - Update maintainer scripts.
    - Rename d/dovecot-postfix.* to debian/mail-stack-delivery.*
    - d/mail-stack-delivery.preinst: Move previously installed backups and
      config files to a new package namespace.
    - d/mail-stack-delivery.prerm: Added to handle downgrades.
  + Use Snakeoil SSL certificates by default:
    - d/control: Depend on ssl-cert.
    - d/dovecot-core.postinst: Relax grep for SSL_* a bit.
  + Add autopkgtest to debian/tests/*.
  + Add ufw integration:
    - d/dovecot-core.ufw.profile: new ufw profile.
    - d/rules: install profile in dovecot-core.
    - d/control: dovecot-core - suggest ufw.
  + d/dovecot-core.dirs: Added usr/share/doc/dovecot-core
  + Add apport hook:
    - d/rules, d/source_dovecot.py
  + Add upstart job:
    - d/rules, d/dovecot-core.dovecot.upstart, d/control,
      d/dovecot-core.dirs, dovecot-imapd.{postrm, postinst, prerm},
      d/dovecot-pop3d.{postinst, postrm, prerm}.
      d/mail-stack-deliver.postinst: Convert init script to upstart.
  + Use the autotools-dev dh addon to update config.guess/config.sub for
    arm64.
* Dropped changes, included in Debian:
  - Update Dovecot name to reflect distribution in login greeting.
  - Update Drac plugin for >= 2.0.0 support.
* d/control: Drop dovecot-postfix package as its no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (c) 2007-2013 Dovecot authors, see the included COPYING file */
 
2
 
 
3
#include "test-lib.h"
 
4
#include "str.h"
 
5
#include "buffer.h"
 
6
#include "unichar.h"
 
7
 
 
8
void test_unichar(void)
 
9
{
 
10
        static const char overlong_utf8[] = "\xf8\x80\x95\x81\xa1";
 
11
        static const char collate_in[] = "\xc3\xbc \xc2\xb3";
 
12
        static const char collate_exp[] = "U\xcc\x88 3";
 
13
        buffer_t *collate_out;
 
14
        unichar_t chr, chr2;
 
15
        string_t *str = t_str_new(16);
 
16
 
 
17
        test_begin("unichars");
 
18
        for (chr = 0; chr <= 0x10ffff; chr++) {
 
19
                str_truncate(str, 0);
 
20
                uni_ucs4_to_utf8_c(chr, str);
 
21
                test_assert(uni_utf8_str_is_valid(str_c(str)));
 
22
                test_assert(uni_utf8_get_char(str_c(str), &chr2) > 0);
 
23
                test_assert(chr2 == chr);
 
24
        }
 
25
 
 
26
        collate_out = buffer_create_dynamic(default_pool, 32);
 
27
        uni_utf8_to_decomposed_titlecase(collate_in, sizeof(collate_in),
 
28
                                         collate_out);
 
29
        test_assert(!strcmp(collate_out->data, collate_exp));
 
30
        buffer_free(&collate_out);
 
31
 
 
32
        test_assert(!uni_utf8_str_is_valid(overlong_utf8));
 
33
        test_assert(uni_utf8_get_char(overlong_utf8, &chr2) < 0);
 
34
        test_end();
 
35
}